1010
1111import debug # pyflakes:ignore
1212
13- from ietf .doc .models import DocEvent
13+ from ietf .doc .factories import DocumentFactory , WgDraftFactory
14+ from ietf .doc .models import DocEvent , RelatedDocument
1415from ietf .group .models import Role , Group
1516from ietf .group .utils import get_group_role_emails , get_child_group_role_emails , get_group_ad_emails
16- from ietf .group .factories import GroupFactory
17+ from ietf .group .factories import GroupFactory , RoleFactory
1718from ietf .utils .test_runner import set_coverage_checking
19+ from ietf .person .factories import EmailFactory
1820from ietf .person .models import Person
19- from ietf .utils .test_data import make_test_data
2021from ietf .utils .test_utils import login_testing_unauthorized , TestCase , unicontent
2122
2223if getattr (settings ,'SKIP_DOT_TO_PDF' , False ):
3536
3637class StreamTests (TestCase ):
3738 def test_streams (self ):
38- make_test_data ()
3939 r = self .client .get (urlreverse ("ietf.group.views.streams" ))
4040 self .assertEqual (r .status_code , 200 )
4141 self .assertTrue ("Independent Submission Editor" in unicontent (r ))
4242
4343 def test_stream_documents (self ):
44- draft = make_test_data ( )
44+ draft = DocumentFactory ( type_id = 'draft' , group__acronym = 'iab' , states = [( 'draft' , 'active' )] )
4545 draft .stream_id = "iab"
4646 draft .save_with_history ([DocEvent .objects .create (doc = draft , rev = draft .rev , type = "changed_stream" , by = Person .objects .get (user__username = "secretary" ), desc = "Test" )])
4747
@@ -50,7 +50,7 @@ def test_stream_documents(self):
5050 self .assertTrue (draft .name in unicontent (r ))
5151
5252 def test_stream_edit (self ):
53- make_test_data ( )
53+ EmailFactory ( address = "ad2@ietf.org" )
5454
5555 stream_acronym = "ietf"
5656
@@ -71,12 +71,14 @@ class GroupDocDependencyGraphTests(TestCase):
7171
7272 def setUp (self ):
7373 set_coverage_checking (False )
74+ a = WgDraftFactory ()
75+ b = WgDraftFactory ()
76+ RelatedDocument .objects .create (source = a ,target = b .docalias_set .first (),relationship_id = 'normref' )
7477
7578 def tearDown (self ):
7679 set_coverage_checking (True )
7780
7881 def test_group_document_dependency_dotfile (self ):
79- make_test_data ()
8082 for group in Group .objects .filter (Q (type = "wg" ) | Q (type = "rg" )):
8183 client = Client (Accept = 'text/plain' )
8284 for url in [ urlreverse ("ietf.group.views.dependencies" ,kwargs = dict (acronym = group .acronym ,output_type = "dot" )),
@@ -89,7 +91,6 @@ def test_group_document_dependency_dotfile(self):
8991 "%s has no content" % group .acronym )
9092
9193 def test_group_document_dependency_pdffile (self ):
92- make_test_data ()
9394 for group in Group .objects .filter (Q (type = "wg" ) | Q (type = "rg" )):
9495 client = Client (Accept = 'application/pdf' )
9596 for url in [ urlreverse ("ietf.group.views.dependencies" ,kwargs = dict (acronym = group .acronym ,output_type = "pdf" )),
@@ -102,7 +103,6 @@ def test_group_document_dependency_pdffile(self):
102103 "%s has no content" % group .acronym )
103104
104105 def test_group_document_dependency_svgfile (self ):
105- make_test_data ()
106106 for group in Group .objects .filter (Q (type = "wg" ) | Q (type = "rg" )):
107107 client = Client (Accept = 'image/svg+xml' )
108108 for url in [ urlreverse ("ietf.group.views.dependencies" ,kwargs = dict (acronym = group .acronym ,output_type = "svg" )),
@@ -116,9 +116,17 @@ def test_group_document_dependency_svgfile(self):
116116
117117
118118class GroupRoleEmailTests (TestCase ):
119+
120+ def setUp (self ):
121+ # make_immutable_base_data makes two areas, and puts a group in one of them
122+ # the tests below assume all areas have groups
123+ for area in Group .objects .filter (type_id = 'area' ):
124+ for iter_count in range (2 ):
125+ group = GroupFactory (type_id = 'wg' ,parent = area )
126+ RoleFactory (group = group ,name_id = 'chair' ,person__user__email = '{%s}chairman@ietf.org' % group .acronym )
127+ RoleFactory (group = group ,name_id = 'secr' ,person__user__email = '{%s}secretary@ietf.org' % group .acronym )
119128
120129 def test_group_role_emails (self ):
121- make_test_data ()
122130 wgs = Group .objects .filter (type = 'wg' )
123131 for wg in wgs :
124132 chair_emails = get_group_role_emails (wg , ['chair' ])
@@ -129,7 +137,6 @@ def test_group_role_emails(self):
129137 self .assertEqual (secr_emails | chair_emails , both_emails )
130138
131139 def test_child_group_role_emails (self ):
132- make_test_data ()
133140 areas = Group .objects .filter (type = 'area' )
134141 for area in areas :
135142 emails = get_child_group_role_emails (area , ['chair' , 'secr' ])
@@ -138,7 +145,6 @@ def test_child_group_role_emails(self):
138145 self .assertIn ('@' , item )
139146
140147 def test_group_ad_emails (self ):
141- make_test_data ()
142148 wgs = Group .objects .filter (type = 'wg' )
143149 for wg in wgs :
144150 emails = get_group_ad_emails (wg )
0 commit comments