diff --git a/colab_spb/fixtures/colab_spb.json b/colab_spb/fixtures/colab_spb.json new file mode 100644 index 0000000..28019c6 --- /dev/null +++ b/colab_spb/fixtures/colab_spb.json @@ -0,0 +1,383 @@ +[ +{ + "fields": { + "logo": "", + "description": "", + "last_imported_index": 0, + "name": "ListA", + "email": "listA@example.com" + }, + "model": "super_archives.mailinglist", + "pk": 1 +}, +{ + "fields": { + "logo": "", + "description": "", + "last_imported_index": 0, + "name": "ListB", + "email": "listB@example.com" + }, + "model": "super_archives.mailinglist", + "pk": 2 +}, +{ + "fields": { + "logo": "", + "description": "", + "last_imported_index": 0, + "name": "ListC", + "email": "listC@example.com" + }, + "model": "super_archives.mailinglist", + "pk": 3 +}, +{ + "fields": { + "spam": false, + "subject_token": "Thread_1_on_List_A", + "mailinglist": 1, + "score": 31, + "latest_message": 3 + }, + "model": "super_archives.thread", + "pk": 1 +}, +{ + "fields": { + "spam": false, + "subject_token": "Thread_1_on_List_B", + "mailinglist": 2, + "score": 0, + "latest_message": 4 + }, + "model": "super_archives.thread", + "pk": 3 +}, +{ + "fields": { + "spam": false, + "subject_token": "Thread_1_on_List_C", + "mailinglist": 3, + "score": 0, + "latest_message": 5 + }, + "model": "super_archives.thread", + "pk": 4 +}, +{ + "fields": { + "spam": false, + "subject_token": "Thread_2_on_List_A", + "mailinglist": 1, + "score": 0, + "latest_message": 6 + }, + "model": "super_archives.thread", + "pk": 5 +}, +{ + "fields": { + "spam": false, + "subject_token": "Thread_3_on_List_A", + "mailinglist": 1, + "score": 0, + "latest_message": 7 + }, + "model": "super_archives.thread", + "pk": 6 +}, +{ + "fields": { + "spam": false, + "subject_token": "Thread_4_on_List_A", + "mailinglist": 1, + "score": 0, + "latest_message": 8 + }, + "model": "super_archives.thread", + "pk": 7 +}, +{ + "fields": { + "spam": false, + "subject_token": "Thread_5_on_List_A", + "mailinglist": 1, + "score": 0, + "latest_message": 9 + }, + "model": "super_archives.thread", + "pk": 8 +}, +{ + "fields": { + "spam": false, + "subject_token": "Thread_6_on_List_A", + "mailinglist": 1, + "score": 0, + "latest_message": 10 + }, + "model": "super_archives.thread", + "pk": 9 +}, +{ + "fields": { + "spam": false, + "subject_token": "Thread_7_on_List_A", + "mailinglist": 1, + "score": 0, + "latest_message": 11 + }, + "model": "super_archives.thread", + "pk": 10 +}, +{ + "fields": { + "spam": false, + "subject_token": "Thread_8_on_List_A", + "mailinglist": 1, + "score": 0, + "latest_message": 12 + }, + "model": "super_archives.thread", + "pk": 11 +}, +{ + "fields": { + "body": "This is a repply to Thread 1 on list A", + "received_time": "2015-01-28T12:43:00.752Z", + "from_address": 1, + "thread": 1, + "spam": false, + "subject_clean": "Response to Thread 1A", + "message_id": "mt1a", + "subject": "Response to Thread 1A" + }, + "model": "super_archives.message", + "pk": 3 +}, +{ + "fields": { + "body": "This is a repply to Thread 2 on list A", + "received_time": "2015-01-28T12:43:00.752Z", + "from_address": 1, + "thread": 5, + "spam": false, + "subject_clean": "Response to Thread 2A", + "message_id": "mt2a", + "subject": "Response to Thread 2A" + }, + "model": "super_archives.message", + "pk": 6 +}, +{ + "fields": { + "body": "This is a repply to Thread 3 on list A", + "received_time": "2015-01-28T12:43:00.752Z", + "from_address": 1, + "thread": 6, + "spam": false, + "subject_clean": "Response to Thread 3A", + "message_id": "mt3a", + "subject": "Response to Thread 3A" + }, + "model": "super_archives.message", + "pk": 7 +}, +{ + "fields": { + "body": "This is a repply to Thread 4 on list A", + "received_time": "2015-01-28T12:43:00.752Z", + "from_address": 1, + "thread": 7, + "spam": false, + "subject_clean": "Response to Thread 4A", + "message_id": "mt4a", + "subject": "Response to Thread 4A" + }, + "model": "super_archives.message", + "pk": 8 +}, +{ + "fields": { + "body": "This is a repply to Thread 5 on list A", + "received_time": "2015-01-28T12:43:00.752Z", + "from_address": 1, + "thread": 8, + "spam": false, + "subject_clean": "Response to Thread 5A", + "message_id": "mt5a", + "subject": "Response to Thread 5A" + }, + "model": "super_archives.message", + "pk": 9 +}, +{ + "fields": { + "body": "This is a repply to Thread 6 on list A", + "received_time": "2015-01-28T12:43:00.752Z", + "from_address": 1, + "thread": 9, + "spam": false, + "subject_clean": "Response to Thread 6A", + "message_id": "mt6a", + "subject": "Response to Thread 6A" + }, + "model": "super_archives.message", + "pk": 10 +}, +{ + "fields": { + "body": "This is a repply to Thread 7 on list A", + "received_time": "2015-01-28T12:43:00.752Z", + "from_address": 1, + "thread": 10, + "spam": false, + "subject_clean": "Response to Thread 7A", + "message_id": "mt7a", + "subject": "Response to Thread 7A" + }, + "model": "super_archives.message", + "pk": 11 +}, +{ + "fields": { + "body": "This is a repply to Thread 8 on list A", + "received_time": "2015-01-28T12:43:00.752Z", + "from_address": 1, + "thread": 11, + "spam": false, + "subject_clean": "Response to Thread 8A", + "message_id": "mt8a", + "subject": "Response to Thread 8A" + }, + "model": "super_archives.message", + "pk": 12 +}, +{ + "fields": { + "body": "This is a repply to Thread 1 on list B", + "received_time": "2015-01-28T12:57:22.180Z", + "from_address": 1, + "thread": 3, + "spam": false, + "subject_clean": "Message 1 on Thread 1B", + "message_id": "", + "subject": "Message 1 on Thread 1B" + }, + "model": "super_archives.message", + "pk": 4 +}, +{ + "fields": { + "body": "This is a repply to Thread 1 on list C", + "received_time": "2015-01-28T13:02:12.903Z", + "from_address": 1, + "thread": 4, + "spam": false, + "subject_clean": "Message 1 on Thread 1C", + "message_id": "", + "subject": "Message 1 on Thread 1C" + }, + "model": "super_archives.message", + "pk": 5 +}, +{ + "fields": { + "last_name": "Administrator", + "webpage": "", + "twitter": "", + "is_staff": true, + "user_permissions": [], + "date_joined": "2015-01-28T12:34:58.770Z", + "google_talk": "", + "first_name": "Admin", + "is_superuser": true, + "last_login": "2015-01-28T12:35:39.621Z", + "verification_hash": null, + "role": "", + "email": "admin@mail.com", + "username": "admin", + "bio": "", + "needs_update": true, + "is_active": true, + "facebook": "", + "groups": [], + "password": "pbkdf2_sha256$12000$iiKCMnLZnFJw$UTx89LB8oYTiw9UqkcglzFLmIaZtbr+ZzF1cG3vfcyo=", + "institution": "", + "github": "", + "modified": "2015-01-28T12:45:27.375Z" + }, + "model": "accounts.user", + "pk": 1 +}, +{ + "fields": { + "last_name": "Norris", + "webpage": "", + "twitter": "", + "is_staff": true, + "user_permissions": [], + "date_joined": "2015-01-28T12:34:58.770Z", + "google_talk": "", + "first_name": "Chuck", + "is_superuser": true, + "last_login": "2015-01-28T12:35:39.621Z", + "verification_hash": null, + "role": "", + "email": "chucknorris@mail.com", + "username": "chucknorris", + "bio": "", + "needs_update": true, + "is_active": true, + "facebook": "", + "groups": [], + "password": "pbkdf2_sha256$12000$iiKCMnLZnFJw$UTx89LB8oYTiw9UqkcglzFLmIaZtbr+ZzF1cG3vfcyo=", + "institution": "", + "github": "", + "modified": "2015-01-28T12:45:27.375Z" + }, + "model": "accounts.user", + "pk": 2 +}, + +{ + "fields": { + "last_name": "Norris", + "webpage": "", + "twitter": "", + "is_staff": true, + "user_permissions": [], + "date_joined": "2015-01-28T12:34:58.770Z", + "google_talk": "", + "first_name": "Heisenberg", + "is_superuser": true, + "last_login": "2015-01-28T12:35:39.621Z", + "verification_hash": null, + "role": "", + "email": "heisenberg@mail.com", + "username": "heisenbergnorris", + "bio": "", + "needs_update": true, + "is_active": true, + "facebook": "", + "groups": [], + "password": "pbkdf2_sha256$12000$iiKCMnLZnFJw$UTx89LB8oYTiw9UqkcglzFLmIaZtbr+ZzF1cG3vfcyo=", + "institution": "", + "github": "", + "modified": "2015-01-28T12:45:27.375Z" + }, + "model": "accounts.user", + "pk": 3 +}, +{ + "fields": { + "real_name": "Administrator", + "user": 1, + "md5": "edb0e96701c209ab4b50211c856c50c4", + "address": "admin@mail.com" + }, + "model": "super_archives.emailaddress", + "pk": 1 +} +] diff --git a/colab_spb/fixtures/test_colab_spb.json b/colab_spb/fixtures/test_colab_spb.json deleted file mode 100644 index 28019c6..0000000 --- a/colab_spb/fixtures/test_colab_spb.json +++ /dev/null @@ -1,383 +0,0 @@ -[ -{ - "fields": { - "logo": "", - "description": "", - "last_imported_index": 0, - "name": "ListA", - "email": "listA@example.com" - }, - "model": "super_archives.mailinglist", - "pk": 1 -}, -{ - "fields": { - "logo": "", - "description": "", - "last_imported_index": 0, - "name": "ListB", - "email": "listB@example.com" - }, - "model": "super_archives.mailinglist", - "pk": 2 -}, -{ - "fields": { - "logo": "", - "description": "", - "last_imported_index": 0, - "name": "ListC", - "email": "listC@example.com" - }, - "model": "super_archives.mailinglist", - "pk": 3 -}, -{ - "fields": { - "spam": false, - "subject_token": "Thread_1_on_List_A", - "mailinglist": 1, - "score": 31, - "latest_message": 3 - }, - "model": "super_archives.thread", - "pk": 1 -}, -{ - "fields": { - "spam": false, - "subject_token": "Thread_1_on_List_B", - "mailinglist": 2, - "score": 0, - "latest_message": 4 - }, - "model": "super_archives.thread", - "pk": 3 -}, -{ - "fields": { - "spam": false, - "subject_token": "Thread_1_on_List_C", - "mailinglist": 3, - "score": 0, - "latest_message": 5 - }, - "model": "super_archives.thread", - "pk": 4 -}, -{ - "fields": { - "spam": false, - "subject_token": "Thread_2_on_List_A", - "mailinglist": 1, - "score": 0, - "latest_message": 6 - }, - "model": "super_archives.thread", - "pk": 5 -}, -{ - "fields": { - "spam": false, - "subject_token": "Thread_3_on_List_A", - "mailinglist": 1, - "score": 0, - "latest_message": 7 - }, - "model": "super_archives.thread", - "pk": 6 -}, -{ - "fields": { - "spam": false, - "subject_token": "Thread_4_on_List_A", - "mailinglist": 1, - "score": 0, - "latest_message": 8 - }, - "model": "super_archives.thread", - "pk": 7 -}, -{ - "fields": { - "spam": false, - "subject_token": "Thread_5_on_List_A", - "mailinglist": 1, - "score": 0, - "latest_message": 9 - }, - "model": "super_archives.thread", - "pk": 8 -}, -{ - "fields": { - "spam": false, - "subject_token": "Thread_6_on_List_A", - "mailinglist": 1, - "score": 0, - "latest_message": 10 - }, - "model": "super_archives.thread", - "pk": 9 -}, -{ - "fields": { - "spam": false, - "subject_token": "Thread_7_on_List_A", - "mailinglist": 1, - "score": 0, - "latest_message": 11 - }, - "model": "super_archives.thread", - "pk": 10 -}, -{ - "fields": { - "spam": false, - "subject_token": "Thread_8_on_List_A", - "mailinglist": 1, - "score": 0, - "latest_message": 12 - }, - "model": "super_archives.thread", - "pk": 11 -}, -{ - "fields": { - "body": "This is a repply to Thread 1 on list A", - "received_time": "2015-01-28T12:43:00.752Z", - "from_address": 1, - "thread": 1, - "spam": false, - "subject_clean": "Response to Thread 1A", - "message_id": "mt1a", - "subject": "Response to Thread 1A" - }, - "model": "super_archives.message", - "pk": 3 -}, -{ - "fields": { - "body": "This is a repply to Thread 2 on list A", - "received_time": "2015-01-28T12:43:00.752Z", - "from_address": 1, - "thread": 5, - "spam": false, - "subject_clean": "Response to Thread 2A", - "message_id": "mt2a", - "subject": "Response to Thread 2A" - }, - "model": "super_archives.message", - "pk": 6 -}, -{ - "fields": { - "body": "This is a repply to Thread 3 on list A", - "received_time": "2015-01-28T12:43:00.752Z", - "from_address": 1, - "thread": 6, - "spam": false, - "subject_clean": "Response to Thread 3A", - "message_id": "mt3a", - "subject": "Response to Thread 3A" - }, - "model": "super_archives.message", - "pk": 7 -}, -{ - "fields": { - "body": "This is a repply to Thread 4 on list A", - "received_time": "2015-01-28T12:43:00.752Z", - "from_address": 1, - "thread": 7, - "spam": false, - "subject_clean": "Response to Thread 4A", - "message_id": "mt4a", - "subject": "Response to Thread 4A" - }, - "model": "super_archives.message", - "pk": 8 -}, -{ - "fields": { - "body": "This is a repply to Thread 5 on list A", - "received_time": "2015-01-28T12:43:00.752Z", - "from_address": 1, - "thread": 8, - "spam": false, - "subject_clean": "Response to Thread 5A", - "message_id": "mt5a", - "subject": "Response to Thread 5A" - }, - "model": "super_archives.message", - "pk": 9 -}, -{ - "fields": { - "body": "This is a repply to Thread 6 on list A", - "received_time": "2015-01-28T12:43:00.752Z", - "from_address": 1, - "thread": 9, - "spam": false, - "subject_clean": "Response to Thread 6A", - "message_id": "mt6a", - "subject": "Response to Thread 6A" - }, - "model": "super_archives.message", - "pk": 10 -}, -{ - "fields": { - "body": "This is a repply to Thread 7 on list A", - "received_time": "2015-01-28T12:43:00.752Z", - "from_address": 1, - "thread": 10, - "spam": false, - "subject_clean": "Response to Thread 7A", - "message_id": "mt7a", - "subject": "Response to Thread 7A" - }, - "model": "super_archives.message", - "pk": 11 -}, -{ - "fields": { - "body": "This is a repply to Thread 8 on list A", - "received_time": "2015-01-28T12:43:00.752Z", - "from_address": 1, - "thread": 11, - "spam": false, - "subject_clean": "Response to Thread 8A", - "message_id": "mt8a", - "subject": "Response to Thread 8A" - }, - "model": "super_archives.message", - "pk": 12 -}, -{ - "fields": { - "body": "This is a repply to Thread 1 on list B", - "received_time": "2015-01-28T12:57:22.180Z", - "from_address": 1, - "thread": 3, - "spam": false, - "subject_clean": "Message 1 on Thread 1B", - "message_id": "", - "subject": "Message 1 on Thread 1B" - }, - "model": "super_archives.message", - "pk": 4 -}, -{ - "fields": { - "body": "This is a repply to Thread 1 on list C", - "received_time": "2015-01-28T13:02:12.903Z", - "from_address": 1, - "thread": 4, - "spam": false, - "subject_clean": "Message 1 on Thread 1C", - "message_id": "", - "subject": "Message 1 on Thread 1C" - }, - "model": "super_archives.message", - "pk": 5 -}, -{ - "fields": { - "last_name": "Administrator", - "webpage": "", - "twitter": "", - "is_staff": true, - "user_permissions": [], - "date_joined": "2015-01-28T12:34:58.770Z", - "google_talk": "", - "first_name": "Admin", - "is_superuser": true, - "last_login": "2015-01-28T12:35:39.621Z", - "verification_hash": null, - "role": "", - "email": "admin@mail.com", - "username": "admin", - "bio": "", - "needs_update": true, - "is_active": true, - "facebook": "", - "groups": [], - "password": "pbkdf2_sha256$12000$iiKCMnLZnFJw$UTx89LB8oYTiw9UqkcglzFLmIaZtbr+ZzF1cG3vfcyo=", - "institution": "", - "github": "", - "modified": "2015-01-28T12:45:27.375Z" - }, - "model": "accounts.user", - "pk": 1 -}, -{ - "fields": { - "last_name": "Norris", - "webpage": "", - "twitter": "", - "is_staff": true, - "user_permissions": [], - "date_joined": "2015-01-28T12:34:58.770Z", - "google_talk": "", - "first_name": "Chuck", - "is_superuser": true, - "last_login": "2015-01-28T12:35:39.621Z", - "verification_hash": null, - "role": "", - "email": "chucknorris@mail.com", - "username": "chucknorris", - "bio": "", - "needs_update": true, - "is_active": true, - "facebook": "", - "groups": [], - "password": "pbkdf2_sha256$12000$iiKCMnLZnFJw$UTx89LB8oYTiw9UqkcglzFLmIaZtbr+ZzF1cG3vfcyo=", - "institution": "", - "github": "", - "modified": "2015-01-28T12:45:27.375Z" - }, - "model": "accounts.user", - "pk": 2 -}, - -{ - "fields": { - "last_name": "Norris", - "webpage": "", - "twitter": "", - "is_staff": true, - "user_permissions": [], - "date_joined": "2015-01-28T12:34:58.770Z", - "google_talk": "", - "first_name": "Heisenberg", - "is_superuser": true, - "last_login": "2015-01-28T12:35:39.621Z", - "verification_hash": null, - "role": "", - "email": "heisenberg@mail.com", - "username": "heisenbergnorris", - "bio": "", - "needs_update": true, - "is_active": true, - "facebook": "", - "groups": [], - "password": "pbkdf2_sha256$12000$iiKCMnLZnFJw$UTx89LB8oYTiw9UqkcglzFLmIaZtbr+ZzF1cG3vfcyo=", - "institution": "", - "github": "", - "modified": "2015-01-28T12:45:27.375Z" - }, - "model": "accounts.user", - "pk": 3 -}, -{ - "fields": { - "real_name": "Administrator", - "user": 1, - "md5": "edb0e96701c209ab4b50211c856c50c4", - "address": "admin@mail.com" - }, - "model": "super_archives.emailaddress", - "pk": 1 -} -] diff --git a/colab_spb/tests/test_get_list.py b/colab_spb/tests/test_get_list.py index 7a76caa..e019394 100644 --- a/colab_spb/tests/test_get_list.py +++ b/colab_spb/tests/test_get_list.py @@ -1,10 +1,11 @@ from django.http import HttpResponsePermanentRedirect from django.test import TestCase, Client +from colab.super_archives.models import * class ColabSPB(TestCase): - fixtures = ['test_colab_spb.json'] + fixtures = ['colab_spb.json'] def setUp(self): super(ColabSPB, self).setUp() @@ -25,3 +26,4 @@ class ColabSPB(TestCase): def test_getlist_default_MAX(self): response = self.client.get("/spb/get_list/?list_name=ListA") self.assertEqual(7,len(response.context[1]['latest'])) + pass diff --git a/tests/plugins.d/spb.py b/tests/plugins.d/spb.py index 157d1a8..3f03183 100644 --- a/tests/plugins.d/spb.py +++ b/tests/plugins.d/spb.py @@ -1,12 +1,12 @@ -from colab.plugins.utils.menu import colab_url_factory - -name = 'colab_spb' -verbose_name = 'Spb plugin' - -urls = { - 'include': 'colab_spb.urls', - 'namespace': 'spb', - 'prefix': 'spb', -} - -url = colab_url_factory("spb") +from django.utils.translation import ugettext_lazy as _ +from colab.plugins.utils.menu import colab_url_factory + +name = "colab_spb" +verbose_name = "SPB Plugin" +urls = { + "include":"colab_spb.urls", + "prefix": '^spb/', + "namespace":"colab_spb" + } + +url = colab_url_factory('colab_spb') -- libgit2 0.21.2