@@ -2181,152 +2181,6 @@ def tearDown(self):
2181
2181
os .unlink (self .doc_virtual_file .name )
2182
2182
super ().tearDown ()
2183
2183
2184
- def testManagementCommand (self ):
2185
- a_month_ago = (timezone .now () - datetime .timedelta (30 )).astimezone (RPC_TZINFO )
2186
- a_month_ago = a_month_ago .replace (hour = 0 , minute = 0 , second = 0 , microsecond = 0 )
2187
- ad = RoleFactory (
2188
- name_id = "ad" , group__type_id = "area" , group__state_id = "active"
2189
- ).person
2190
- shepherd = PersonFactory ()
2191
- author1 = PersonFactory ()
2192
- author2 = PersonFactory ()
2193
- author3 = PersonFactory ()
2194
- author4 = PersonFactory ()
2195
- author5 = PersonFactory ()
2196
- author6 = PersonFactory ()
2197
- mars = GroupFactory (type_id = "wg" , acronym = "mars" )
2198
- marschairman = PersonFactory (user__username = "marschairman" )
2199
- mars .role_set .create (
2200
- name_id = "chair" , person = marschairman , email = marschairman .email ()
2201
- )
2202
- doc1 = IndividualDraftFactory (
2203
- authors = [author1 ], shepherd = shepherd .email (), ad = ad
2204
- )
2205
- doc2 = WgDraftFactory (
2206
- name = "draft-ietf-mars-test" , group__acronym = "mars" , authors = [author2 ], ad = ad
2207
- )
2208
- doc3 = WgDraftFactory .create (
2209
- name = "draft-ietf-mars-finished" ,
2210
- group__acronym = "mars" ,
2211
- authors = [author3 ],
2212
- ad = ad ,
2213
- std_level_id = "ps" ,
2214
- states = [("draft" , "rfc" ), ("draft-iesg" , "pub" )],
2215
- time = a_month_ago ,
2216
- )
2217
- rfc3 = WgRfcFactory ()
2218
- DocEventFactory .create (doc = rfc3 , type = "published_rfc" , time = a_month_ago )
2219
- doc3 .relateddocument_set .create (
2220
- relationship_id = "became_rfc" , target = rfc3
2221
- )
2222
- doc4 = WgDraftFactory .create (
2223
- authors = [author4 , author5 ],
2224
- ad = ad ,
2225
- std_level_id = "ps" ,
2226
- states = [("draft" , "rfc" ), ("draft-iesg" , "pub" )],
2227
- time = datetime .datetime (2010 , 10 , 10 , tzinfo = ZoneInfo (settings .TIME_ZONE )),
2228
- )
2229
- rfc4 = WgRfcFactory ()
2230
- DocEventFactory .create (
2231
- doc = rfc4 ,
2232
- type = "published_rfc" ,
2233
- time = datetime .datetime (2010 , 10 , 10 , tzinfo = RPC_TZINFO ),
2234
- )
2235
- doc4 .relateddocument_set .create (
2236
- relationship_id = "became_rfc" , target = rfc4
2237
- )
2238
- doc5 = IndividualDraftFactory (authors = [author6 ])
2239
-
2240
- args = []
2241
- kwargs = {}
2242
- out = io .StringIO ()
2243
- call_command ("generate_draft_aliases" , * args , ** kwargs , stdout = out , stderr = out )
2244
- self .assertFalse (out .getvalue ())
2245
-
2246
- with open (settings .DRAFT_ALIASES_PATH ) as afile :
2247
- acontent = afile .read ()
2248
- for x in [
2249
- "xfilter-" + doc1 .name ,
2250
- "xfilter-" + doc1 .name + ".ad" ,
2251
- "xfilter-" + doc1 .name + ".authors" ,
2252
- "xfilter-" + doc1 .name + ".shepherd" ,
2253
- "xfilter-" + doc1 .name + ".all" ,
2254
- "xfilter-" + doc2 .name ,
2255
- "xfilter-" + doc2 .name + ".ad" ,
2256
- "xfilter-" + doc2 .name + ".authors" ,
2257
- "xfilter-" + doc2 .name + ".chairs" ,
2258
- "xfilter-" + doc2 .name + ".all" ,
2259
- "xfilter-" + doc3 .name ,
2260
- "xfilter-" + doc3 .name + ".ad" ,
2261
- "xfilter-" + doc3 .name + ".authors" ,
2262
- "xfilter-" + doc3 .name + ".chairs" ,
2263
- "xfilter-" + doc5 .name ,
2264
- "xfilter-" + doc5 .name + ".authors" ,
2265
- "xfilter-" + doc5 .name + ".all" ,
2266
- ]:
2267
- self .assertIn (x , acontent )
2268
-
2269
- for x in [
2270
- "xfilter-" + doc1 .name + ".chairs" ,
2271
- "xfilter-" + doc2 .name + ".shepherd" ,
2272
- "xfilter-" + doc3 .name + ".shepherd" ,
2273
- "xfilter-" + doc4 .name ,
2274
- "xfilter-" + doc5 .name + ".shepherd" ,
2275
- "xfilter-" + doc5 .name + ".ad" ,
2276
- ]:
2277
- self .assertNotIn (x , acontent )
2278
-
2279
- with open (settings .DRAFT_VIRTUAL_PATH ) as vfile :
2280
- vcontent = vfile .read ()
2281
- for x in [
2282
- ad .email_address (),
2283
- shepherd .email_address (),
2284
- marschairman .email_address (),
2285
- author1 .email_address (),
2286
- author2 .email_address (),
2287
- author3 .email_address (),
2288
- author6 .email_address (),
2289
- ]:
2290
- self .assertIn (x , vcontent )
2291
-
2292
- for x in [
2293
- author4 .email_address (),
2294
- author5 .email_address (),
2295
- ]:
2296
- self .assertNotIn (x , vcontent )
2297
-
2298
- for x in [
2299
- "xfilter-" + doc1 .name ,
2300
- "xfilter-" + doc1 .name + ".ad" ,
2301
- "xfilter-" + doc1 .name + ".authors" ,
2302
- "xfilter-" + doc1 .name + ".shepherd" ,
2303
- "xfilter-" + doc1 .name + ".all" ,
2304
- "xfilter-" + doc2 .name ,
2305
- "xfilter-" + doc2 .name + ".ad" ,
2306
- "xfilter-" + doc2 .name + ".authors" ,
2307
- "xfilter-" + doc2 .name + ".chairs" ,
2308
- "xfilter-" + doc2 .name + ".all" ,
2309
- "xfilter-" + doc3 .name ,
2310
- "xfilter-" + doc3 .name + ".ad" ,
2311
- "xfilter-" + doc3 .name + ".authors" ,
2312
- "xfilter-" + doc3 .name + ".chairs" ,
2313
- "xfilter-" + doc3 .name + ".all" ,
2314
- "xfilter-" + doc5 .name ,
2315
- "xfilter-" + doc5 .name + ".authors" ,
2316
- "xfilter-" + doc5 .name + ".all" ,
2317
- ]:
2318
- self .assertIn (x , vcontent )
2319
-
2320
- for x in [
2321
- "xfilter-" + doc1 .name + ".chairs" ,
2322
- "xfilter-" + doc2 .name + ".shepherd" ,
2323
- "xfilter-" + doc3 .name + ".shepherd" ,
2324
- "xfilter-" + doc4 .name ,
2325
- "xfilter-" + doc5 .name + ".shepherd" ,
2326
- "xfilter-" + doc5 .name + ".ad" ,
2327
- ]:
2328
- self .assertNotIn (x , vcontent )
2329
-
2330
2184
@override_settings (TOOLS_SERVER = "tools.example.org" , DRAFT_ALIAS_DOMAIN = "draft.example.org" )
2331
2185
def test_generator_class (self ):
2332
2186
"""The DraftAliasGenerator should generate the same lists as the old mgmt cmd"""
0 commit comments