diff --git a/zephyr/fixtures/zephyrs.json b/zephyr/fixtures/zephyrs.json deleted file mode 100644 index 7f2e9293d1..0000000000 --- a/zephyr/fixtures/zephyrs.json +++ /dev/null @@ -1 +0,0 @@ -[{"pk": 1, "model": "auth.user", "fields": {"username": "othello", "first_name": "", "last_name": "", "is_active": true, "is_superuser": false, "is_staff": false, "last_login": "2012-09-04T14:57:28.008Z", "groups": [], "user_permissions": [], "password": "pbkdf2_sha256$10000$p9K36PmCZfrw$fxMMG7g3X+fDZsYNx/2d8cJAaWjsVxyVvnpSqPK3VOw=", "email": "", "date_joined": "2012-09-04T14:57:28.008Z"}}, {"pk": 2, "model": "auth.user", "fields": {"username": "iago", "first_name": "", "last_name": "", "is_active": true, "is_superuser": false, "is_staff": false, "last_login": "2012-09-04T14:57:28.225Z", "groups": [], "user_permissions": [], "password": "pbkdf2_sha256$10000$N7J4r7z6qZ1z$eGGs+ucEgMHHG4qUp01xo7nLBNSwBFNiSaxDCR+bZ/k=", "email": "", "date_joined": "2012-09-04T14:57:28.225Z"}}, {"pk": 3, "model": "auth.user", "fields": {"username": "prospero", "first_name": "", "last_name": "", "is_active": true, "is_superuser": false, "is_staff": false, "last_login": "2012-09-04T14:57:28.435Z", "groups": [], "user_permissions": [], "password": "pbkdf2_sha256$10000$1ZCIDYyGCk6x$dNSBXne6yQ7o5YcWdsNOEOzk1AdEL3EJUWKiclgEfAg=", "email": "", "date_joined": "2012-09-04T14:57:28.435Z"}}, {"pk": 4, "model": "auth.user", "fields": {"username": "cordelia", "first_name": "", "last_name": "", "is_active": true, "is_superuser": false, "is_staff": false, "last_login": "2012-09-04T14:57:28.647Z", "groups": [], "user_permissions": [], "password": "pbkdf2_sha256$10000$xaIbHxy0GWFm$WvnuBDGkr1iTld7jc4GLHXflAyAOhiagzFXKryBUTC0=", "email": "", "date_joined": "2012-09-04T14:57:28.647Z"}}, {"pk": 5, "model": "auth.user", "fields": {"username": "hamlet", "first_name": "", "last_name": "", "is_active": true, "is_superuser": false, "is_staff": false, "last_login": "2012-09-04T14:57:28.858Z", "groups": [], "user_permissions": [], "password": "pbkdf2_sha256$10000$W842IE8PznAF$SBqvj31bcTJsytfcbuBjHSILMr5b4Qw0qgKIQiJkLRM=", "email": "", "date_joined": "2012-09-04T14:57:28.858Z"}}, {"pk": 1, "model": "zephyr.userprofile", "fields": {"pointer": -1, "user": 1}}, {"pk": 2, "model": "zephyr.userprofile", "fields": {"pointer": -1, "user": 2}}, {"pk": 3, "model": "zephyr.userprofile", "fields": {"pointer": -1, "user": 3}}, {"pk": 4, "model": "zephyr.userprofile", "fields": {"pointer": -1, "user": 4}}, {"pk": 5, "model": "zephyr.userprofile", "fields": {"pointer": -1, "user": 5}}, {"pk": 1, "model": "zephyr.zephyrclass", "fields": {"name": "Verona"}}, {"pk": 2, "model": "zephyr.zephyrclass", "fields": {"name": "Denmark"}}, {"pk": 3, "model": "zephyr.zephyrclass", "fields": {"name": "Scotland"}}, {"pk": 4, "model": "zephyr.zephyrclass", "fields": {"name": "Venice"}}, {"pk": 5, "model": "zephyr.zephyrclass", "fields": {"name": "Rome"}}, {"pk": 1, "model": "zephyr.recipient", "fields": {"user_or_class": 1, "type": "personal"}}, {"pk": 2, "model": "zephyr.recipient", "fields": {"user_or_class": 2, "type": "personal"}}, {"pk": 3, "model": "zephyr.recipient", "fields": {"user_or_class": 3, "type": "personal"}}, {"pk": 4, "model": "zephyr.recipient", "fields": {"user_or_class": 4, "type": "personal"}}, {"pk": 5, "model": "zephyr.recipient", "fields": {"user_or_class": 5, "type": "personal"}}, {"pk": 6, "model": "zephyr.recipient", "fields": {"user_or_class": 1, "type": "class"}}, {"pk": 7, "model": "zephyr.recipient", "fields": {"user_or_class": 2, "type": "class"}}, {"pk": 8, "model": "zephyr.recipient", "fields": {"user_or_class": 3, "type": "class"}}, {"pk": 9, "model": "zephyr.recipient", "fields": {"user_or_class": 4, "type": "class"}}, {"pk": 10, "model": "zephyr.recipient", "fields": {"user_or_class": 5, "type": "class"}}, {"pk": 1, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 1, "recipient_id": 1}}, {"pk": 2, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 2, "recipient_id": 2}}, {"pk": 3, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 3, "recipient_id": 3}}, {"pk": 4, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 4, "recipient_id": 4}}, {"pk": 5, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 5, "recipient_id": 5}}, {"pk": 6, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 1, "recipient_id": 6}}, {"pk": 7, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 2, "recipient_id": 6}}, {"pk": 8, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 2, "recipient_id": 7}}, {"pk": 9, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 3, "recipient_id": 6}}, {"pk": 10, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 3, "recipient_id": 7}}, {"pk": 11, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 3, "recipient_id": 8}}, {"pk": 12, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 4, "recipient_id": 6}}, {"pk": 13, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 4, "recipient_id": 7}}, {"pk": 14, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 4, "recipient_id": 8}}, {"pk": 15, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 4, "recipient_id": 9}}, {"pk": 16, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 5, "recipient_id": 6}}, {"pk": 17, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 5, "recipient_id": 7}}, {"pk": 18, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 5, "recipient_id": 8}}, {"pk": 19, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 5, "recipient_id": 9}}, {"pk": 20, "model": "zephyr.subscription", "fields": {"active": true, "userprofile_id": 5, "recipient_id": 10}}, {"pk": 1, "model": "zephyr.zephyr", "fields": {"content": "From off a hill whose concave womb reworded\nA plaintful story from a sist'ring vale,\nMy spirits t'attend this double voice accorded,\n", "instance": "Scotland3", "recipient": 8, "sender": 4, "pub_date": "2012-09-04T14:57:29.090Z"}}, {"pk": 2, "model": "zephyr.zephyr", "fields": {"content": "And down I laid to list the sad-tuned tale,\nEre long espied a fickle maid full pale,\nTearing of papers, breaking rings atwain,\nStorming her world with sorrow's wind and rain.\n", "instance": "Verona1", "recipient": 6, "sender": 3, "pub_date": "2012-09-04T14:57:29.097Z"}}, {"pk": 3, "model": "zephyr.zephyr", "fields": {"content": "Upon her head a platted hive of straw,\nWhich fortified her visage from the sun,\n", "instance": "Rome3", "recipient": 10, "sender": 1, "pub_date": "2012-09-04T14:57:29.103Z"}}, {"pk": 4, "model": "zephyr.zephyr", "fields": {"content": "Whereon the thought might think sometime it saw\nThe carcase of a beauty spent and done.\nTime had not scythed all that youth begun,\nNor youth all quit, but spite of heaven's fell rage\n", "instance": "Verona1", "recipient": 6, "sender": 4, "pub_date": "2012-09-04T14:57:29.110Z"}}, {"pk": 5, "model": "zephyr.zephyr", "fields": {"content": "Some beauty peeped through lattice of seared age.\nOft did she heave her napkin to her eyne,\n", "instance": "Scotland3", "recipient": 8, "sender": 5, "pub_date": "2012-09-04T14:57:29.117Z"}}] \ No newline at end of file diff --git a/zephyr/tests.py b/zephyr/tests.py index 86d3c15bbf..d3ee7b17ff 100644 --- a/zephyr/tests.py +++ b/zephyr/tests.py @@ -6,6 +6,9 @@ from django.db.models import Q from zephyr.models import Zephyr, UserProfile, ZephyrClass, Recipient, Subscription, filter_by_subscriptions import datetime +import os +import subprocess +subprocess.call("zephyr/tests/generate-fixtures"); class AuthedTestCase(TestCase): def login(self, username, password): @@ -203,3 +206,4 @@ class ClassZephyrsTest(AuthedTestCase): self.assertEqual(old_non_subscriber_zephyrs, new_non_subscriber_zephyrs) self.assertEqual(new_subscriber_zephyrs, [elt + 1 for elt in old_subscriber_zephyrs]) + diff --git a/zephyr/tests/generate-fixtures b/zephyr/tests/generate-fixtures index 78d99027fc..18c8cb7c75 100755 --- a/zephyr/tests/generate-fixtures +++ b/zephyr/tests/generate-fixtures @@ -1,3 +1,3 @@ #!/bin/sh - +mkdir -p zephyr/fixtures python manage.py dumpdata auth.User zephyr.UserProfile zephyr.ZephyrClass zephyr.Recipient zephyr.Subscription zephyr.Zephyr > zephyr/fixtures/zephyrs.json