Skip to content

Commit e4f4467

Browse files
committed
Changed tests to use our own subclassed TestCase, and changed almost all fixtures to be perma_fixtures.
- Legacy-Id: 6320
1 parent 4395949 commit e4f4467

39 files changed

Lines changed: 232 additions & 174 deletions

File tree

ietf/announcements/tests.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import datetime
22

33
from django.conf import settings
4-
import django.test
54

65
from ietf.utils.test_utils import SimpleUrlTestCase, canonicalize_sitemap
76
from ietf.utils.test_data import make_test_data
87
from ietf.utils.mail import outbox
8+
from ietf.utils import TestCase
99

1010
from ietf.announcements.models import ScheduledAnnouncement
1111

@@ -21,7 +21,7 @@ def doCanonicalize(self, url, content):
2121
else:
2222
return content
2323

24-
class SendScheduledAnnouncementsTestCase(django.test.TestCase):
24+
class SendScheduledAnnouncementsTestCase(TestCase):
2525
def test_send_plain_announcement(self):
2626
a = ScheduledAnnouncement.objects.create(
2727
mail_sent=False,
@@ -66,8 +66,9 @@ def test_send_mime_announcement(self):
6666
self.assertTrue(ScheduledAnnouncement.objects.get(id=a.id).mail_sent)
6767

6868

69-
class SendScheduledAnnouncementsTestCaseREDESIGN(django.test.TestCase):
70-
fixtures = ["names"]
69+
class SendScheduledAnnouncementsTestCaseREDESIGN(TestCase):
70+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
71+
perma_fixtures = ["names"]
7172

7273
def test_send_plain_announcement(self):
7374
make_test_data()

ietf/doc/tests.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import os, shutil, datetime
22

3-
import django.test
43
from django.core.urlresolvers import reverse as urlreverse
54

65
from pyquery import PyQuery
76

87
from ietf.utils.mail import outbox
98
from ietf.utils.test_utils import login_testing_unauthorized
109
from ietf.utils.test_data import make_test_data
10+
from ietf.utils import TestCase
1111

1212
from ietf.doc.models import *
1313
from ietf.name.models import *
@@ -23,8 +23,9 @@
2323
from ietf.doc.tests_status_change import *
2424

2525

26-
class SearchTestCase(django.test.TestCase):
27-
fixtures = ['names']
26+
class SearchTestCase(TestCase):
27+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
28+
perma_fixtures = ['names']
2829

2930
def test_search(self):
3031
draft = make_test_data()
@@ -125,8 +126,9 @@ def test_indexes(self):
125126
self.assertTrue(draft.title in r.content)
126127

127128

128-
class DocTestCase(django.test.TestCase):
129-
fixtures = ['names']
129+
class DocTestCase(TestCase):
130+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
131+
perma_fixtures = ['names']
130132

131133
def test_document_draft(self):
132134
draft = make_test_data()
@@ -248,8 +250,9 @@ def test_document_json(self):
248250
self.assertEqual(r.status_code, 200)
249251

250252

251-
class AddCommentTestCase(django.test.TestCase):
252-
fixtures = ['names']
253+
class AddCommentTestCase(TestCase):
254+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
255+
perma_fixtures = ['names']
253256

254257
def test_add_comment(self):
255258
draft = make_test_data()

ietf/doc/tests_ballot.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os, shutil
44
from datetime import date, timedelta, time
55

6-
import django.test
76
from django.core.urlresolvers import reverse as urlreverse
87
from django.conf import settings
98

@@ -19,9 +18,11 @@
1918
from ietf.utils.test_utils import login_testing_unauthorized
2019
from ietf.utils.test_data import make_test_data
2120
from ietf.utils.mail import outbox
21+
from ietf.utils import TestCase
2222

23-
class EditPositionTestCase(django.test.TestCase):
24-
fixtures = ['names']
23+
class EditPositionTestCase(TestCase):
24+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
25+
perma_fixtures = ['names']
2526

2627
def test_edit_position(self):
2728
draft = make_test_data()
@@ -169,8 +170,9 @@ def test_send_ballot_comment(self):
169170
self.assertTrue("Test!" in str(m))
170171

171172

172-
class DeferBallotTestCase(django.test.TestCase):
173-
fixtures = ['names']
173+
class DeferBallotTestCase(TestCase):
174+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
175+
perma_fixtures = ['names']
174176

175177
def test_defer_ballot(self):
176178
draft = make_test_data()
@@ -215,8 +217,9 @@ def test_undefer_ballot(self):
215217
draft = Document.objects.get(name=draft.name)
216218
self.assertEquals(draft.get_state_slug("draft-iesg"), "iesg-eva")
217219

218-
class BallotWriteupsTestCase(django.test.TestCase):
219-
fixtures = ['names']
220+
class BallotWriteupsTestCase(TestCase):
221+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
222+
perma_fixtures = ['names']
220223

221224
def test_edit_last_call_text(self):
222225
draft = make_test_data()
@@ -406,8 +409,9 @@ def test_edit_approval_text(self):
406409
draft = Document.objects.get(name=draft.name)
407410
self.assertTrue("Subject: Results of IETF-conflict review" in draft.latest_event(WriteupDocEvent, type="changed_ballot_approval_text").text)
408411

409-
class ApproveBallotTestCase(django.test.TestCase):
410-
fixtures = ['names']
412+
class ApproveBallotTestCase(TestCase):
413+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
414+
perma_fixtures = ['names']
411415

412416
def test_approve_ballot(self):
413417
draft = make_test_data()
@@ -456,8 +460,9 @@ def test_disapprove_ballot(self):
456460
self.assertEquals(len(outbox), mailbox_before + 3)
457461
self.assertTrue("NOT be published" in str(outbox[-1]))
458462

459-
class MakeLastCallTestCase(django.test.TestCase):
460-
fixtures = ['names']
463+
class MakeLastCallTestCase(TestCase):
464+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
465+
perma_fixtures = ['names']
461466

462467
def test_make_last_call(self):
463468
draft = make_test_data()

ietf/doc/tests_conflict_review.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from textwrap import wrap
77

88

9-
import django.test
109
from django.conf import settings
1110
from django.core.urlresolvers import reverse as urlreverse
1211

@@ -15,16 +14,17 @@
1514
from ietf.utils.mail import outbox
1615
from ietf.doc.utils import create_ballot_if_not_open
1716
from ietf.doc.views_conflict_review import default_approval_text
17+
from ietf.utils import TestCase
1818

1919
from ietf.doc.models import Document,DocEvent,NewRevisionDocEvent,BallotPositionDocEvent,TelechatDocEvent,DocAlias,State
2020
from ietf.name.models import StreamName
2121
from ietf.group.models import Person
2222
from ietf.iesg.models import TelechatDate
2323

2424

25-
class ConflictReviewTestCase(django.test.TestCase):
26-
27-
fixtures = ['names']
25+
class ConflictReviewTestCase(TestCase):
26+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
27+
perma_fixtures = ['names']
2828

2929
def test_start_review(self):
3030

@@ -254,9 +254,9 @@ def setUp(self):
254254
make_test_data()
255255

256256

257-
class ConflictReviewSubmitTestCase(django.test.TestCase):
258-
259-
fixtures = ['names']
257+
class ConflictReviewSubmitTestCase(TestCase):
258+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
259+
perma_fixtures = ['names',]
260260

261261
def test_initial_submission(self):
262262
doc = Document.objects.get(name='conflict-review-imaginary-irtf-submission')

ietf/doc/tests_draft.py

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import os, shutil
44
from datetime import date, timedelta, time
55

6-
import django.test
76
from django.core.urlresolvers import reverse as urlreverse
87
from django.conf import settings
98

@@ -19,10 +18,12 @@
1918
from ietf.utils.test_utils import login_testing_unauthorized
2019
from ietf.utils.test_data import make_test_data
2120
from ietf.utils.mail import outbox
21+
from ietf.utils import TestCase
2222

2323

24-
class ChangeStateTestCase(django.test.TestCase):
25-
fixtures = ['names']
24+
class ChangeStateTestCase(TestCase):
25+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
26+
perma_fixtures = ['names']
2627

2728
def test_change_state(self):
2829
draft = make_test_data()
@@ -177,8 +178,9 @@ def test_request_last_call(self):
177178
self.assertTrue("Last call was requested" in draft.latest_event().desc)
178179

179180

180-
class EditInfoTestCase(django.test.TestCase):
181-
fixtures = ['names']
181+
class EditInfoTestCase(TestCase):
182+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
183+
perma_fixtures = ['names']
182184

183185
def test_edit_info(self):
184186
draft = make_test_data()
@@ -359,8 +361,9 @@ def test_edit_consensus(self):
359361
self.assertEqual(draft.latest_event(ConsensusDocEvent, type="changed_consensus").consensus, True)
360362

361363

362-
class ResurrectTestCase(django.test.TestCase):
363-
fixtures = ['names']
364+
class ResurrectTestCase(TestCase):
365+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
366+
perma_fixtures = ['names']
364367

365368
def test_request_resurrect(self):
366369
draft = make_test_data()
@@ -426,8 +429,9 @@ def test_resurrect(self):
426429
self.assertEquals(len(outbox), mailbox_before + 1)
427430

428431

429-
class ExpireIDsTestCase(django.test.TestCase):
430-
fixtures = ['names']
432+
class ExpireIDsTestCase(TestCase):
433+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
434+
perma_fixtures = ['names']
431435

432436
def setUp(self):
433437
self.id_dir = os.path.abspath("tmp-id-dir")
@@ -608,8 +612,9 @@ def test_clean_up_draft_files(self):
608612
self.assertTrue(not os.path.exists(os.path.join(self.id_dir, txt)))
609613
self.assertTrue(os.path.exists(os.path.join(self.archive_dir, "deleted_tombstones", txt)))
610614

611-
class ExpireLastCallTestCase(django.test.TestCase):
612-
fixtures = ['names']
615+
class ExpireLastCallTestCase(TestCase):
616+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
617+
perma_fixtures = ['names']
613618

614619
def test_expire_last_call(self):
615620
from ietf.doc.lastcall import get_expired_last_calls, expire_last_call
@@ -657,9 +662,9 @@ def test_expire_last_call(self):
657662
self.assertEquals(len(outbox), mailbox_before + 1)
658663
self.assertTrue("Last Call Expired" in outbox[-1]["Subject"])
659664

660-
class IndividualInfoFormsTestCase(django.test.TestCase):
661-
662-
fixtures = ['names']
665+
class IndividualInfoFormsTestCase(TestCase):
666+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
667+
perma_fixtures = ['names']
663668

664669
def test_doc_change_stream(self):
665670
url = urlreverse('doc_change_stream', kwargs=dict(name=self.docname))
@@ -885,8 +890,9 @@ def setUp(self):
885890
self.docname='draft-ietf-mars-test'
886891
self.doc = Document.objects.get(name=self.docname)
887892

888-
class SubmitToIesgTestCase(django.test.TestCase):
889-
fixtures = ['names']
893+
class SubmitToIesgTestCase(TestCase):
894+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
895+
perma_fixtures = ['names']
890896

891897
def verify_permissions(self):
892898

@@ -945,8 +951,9 @@ def setUp(self):
945951
self.doc = Document.objects.get(name=self.docname)
946952
self.doc.unset_state('draft-iesg')
947953

948-
class RequestPublicationTestCase(django.test.TestCase):
949-
fixtures = ['names']
954+
class RequestPublicationTestCase(TestCase):
955+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
956+
perma_fixtures = ['names']
950957

951958
def test_request_publication(self):
952959
draft = make_test_data()

ietf/doc/tests_status_change.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from textwrap import wrap
77

88

9-
import django.test
109
from django.conf import settings
1110
from django.core.urlresolvers import reverse as urlreverse
1211

@@ -15,16 +14,17 @@
1514
from ietf.utils.mail import outbox
1615
from ietf.doc.utils import create_ballot_if_not_open
1716
from ietf.doc.views_status_change import default_approval_text
17+
from ietf.utils import TestCase
1818

1919
from ietf.doc.models import Document,DocEvent,NewRevisionDocEvent,BallotPositionDocEvent,TelechatDocEvent,WriteupDocEvent,DocAlias,State
2020
from ietf.name.models import StreamName
2121
from ietf.group.models import Person
2222
from ietf.iesg.models import TelechatDate
2323

2424

25-
class StatusChangeTestCase(django.test.TestCase):
26-
27-
fixtures = ['names']
25+
class StatusChangeTestCase(TestCase):
26+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
27+
perma_fixtures = ['names']
2828

2929
def test_start_review(self):
3030

@@ -353,9 +353,9 @@ def setUp(self):
353353
make_test_data()
354354

355355

356-
class StatusChangeSubmitTestCase(django.test.TestCase):
357-
358-
fixtures = ['names']
356+
class StatusChangeSubmitTestCase(TestCase):
357+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
358+
perma_fixtures = ['names']
359359

360360
def test_initial_submission(self):
361361
doc = Document.objects.get(name='status-change-imaginary-mid-review')

ietf/group/tests/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66

77
import sys
8-
from django.test import TestCase
8+
from ietf.utils import TestCase
99
from datetime import datetime
1010

1111
# actual tests are distributed among a set of files in subdir tests/

ietf/group/tests/workinggroups.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import sys
2-
from django.test import TestCase
2+
from ietf.utils import TestCase
33
from ietf.group.models import Group
44

55
class WorkingGroupTestCase(TestCase):
6-
fixtures = [ 'workinggroups.json']
6+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
7+
fixtures = [ 'workinggroups', ]
8+
perma_fixtures = []
79

810
def test_FindOneWg(self):
911
one = Group.objects.filter(acronym = 'roll')

ietf/help/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Replace these with more appropriate tests for your application.
66
"""
77

8-
from django.test import TestCase
8+
from ietf.utils import TestCase
99

1010
class SimpleTest(TestCase):
1111
def test_basic_addition(self):

ietf/idindex/tests.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import datetime, shutil
22

3-
import django.test
43
from django.core.urlresolvers import reverse as urlreverse
54

65
from ietf.utils.test_data import make_test_data
6+
from ietf.utils import TestCase
77

88
from ietf.doc.models import *
99
from ietf.idindex.index import *
1010

1111

12-
class IndexTestCase(django.test.TestCase):
13-
fixtures = ['names']
12+
class IndexTestCase(TestCase):
13+
# See ietf.utils.test_utils.TestCase for the use of perma_fixtures vs. fixtures
14+
perma_fixtures = ['names']
1415

1516
def setUp(self):
1617
self.id_dir = os.path.abspath("tmp-id-dir")

0 commit comments

Comments
 (0)