@@ -1707,11 +1707,12 @@ def test_adopt_document(self):
1707
1707
self .assertEqual (draft .group , chair_role .group )
1708
1708
self .assertEqual (draft .stream_id , stream_state_type_slug [type_id ][13 :]) # trim off "draft-stream-"
1709
1709
self .assertEqual (draft .docevent_set .count () - events_before , 5 )
1710
- self .assertEqual (len (outbox ), 1 )
1711
- self .assertTrue ("Call For Adoption" in outbox [- 1 ]["Subject" ])
1712
- self .assertTrue (f"{ chair_role .group .acronym } -chairs@" in outbox [- 1 ]['To' ])
1713
- self .assertTrue (f"{ draft .name } @" in outbox [- 1 ]['To' ])
1714
- self .assertTrue (f"{ chair_role .group .acronym } @" in outbox [- 1 ]['To' ])
1710
+ self .assertEqual (len (outbox ), 2 )
1711
+ self .assertTrue ("Call For Adoption" in outbox [0 ]["Subject" ])
1712
+ self .assertTrue (f"{ chair_role .group .acronym } -chairs@" in outbox [0 ]['To' ])
1713
+ self .assertTrue (f"{ draft .name } @" in outbox [0 ]['To' ])
1714
+ self .assertTrue (f"{ chair_role .group .acronym } @" in outbox [0 ]['To' ])
1715
+ # contents of outbox[1] are tested elsewhere
1715
1716
1716
1717
# adopt
1717
1718
empty_outbox ()
@@ -2001,6 +2002,200 @@ def test_set_state(self):
2001
2002
self .
assertTrue (
"[email protected] " in outbox [
0 ].
as_string ())
2002
2003
self .
assertTrue (
"[email protected] " in outbox [
0 ].
as_string ())
2003
2004
2005
+ def test_wg_call_for_adoption_issued (self ):
2006
+ role = RoleFactory (
2007
+ name_id = "chair" ,
2008
+ group__acronym = "mars" ,
2009
+ group__list_email = "[email protected] " ,
2010
+ person__user__username = "marschairman" ,
2011
+ person__name = "WG Cháir Man" ,
2012
+ )
2013
+ # First test the usual workflow through the manage adoption view
2014
+ draft = IndividualDraftFactory ()
2015
+ url = urlreverse (
2016
+ "ietf.doc.views_draft.adopt_draft" , kwargs = dict (name = draft .name )
2017
+ )
2018
+ login_testing_unauthorized (self , "marschairman" , url )
2019
+ empty_outbox ()
2020
+ call_issued = State .objects .get (type = "draft-stream-ietf" , slug = "c-adopt" )
2021
+ r = self .client .post (
2022
+ url ,
2023
+ dict (
2024
+ comment = "some comment" ,
2025
+ group = role .group .pk ,
2026
+ newstate = call_issued .pk ,
2027
+ weeks = "10" ,
2028
+ ),
2029
+ )
2030
+ self .assertEqual (r .status_code , 302 )
2031
+ self .assertEqual (len (outbox ), 2 )
2032
+ self .
assertIn (
"[email protected] " ,
outbox [
1 ][
"To" ])
2033
+ self .assertIn ("Call for adoption" , outbox [1 ]["Subject" ])
2034
+ body = get_payload_text (outbox [1 ])
2035
+ self .assertIn ("disclosure obligations" , body )
2036
+ self .assertIn ("starts a 10-week" , body )
2037
+ # Test not entering a duration on the form
2038
+ draft = IndividualDraftFactory ()
2039
+ url = urlreverse (
2040
+ "ietf.doc.views_draft.adopt_draft" , kwargs = dict (name = draft .name )
2041
+ )
2042
+ empty_outbox ()
2043
+ call_issued = State .objects .get (type = "draft-stream-ietf" , slug = "c-adopt" )
2044
+ r = self .client .post (
2045
+ url ,
2046
+ dict (
2047
+ comment = "some comment" ,
2048
+ group = role .group .pk ,
2049
+ newstate = call_issued .pk ,
2050
+ ),
2051
+ )
2052
+ self .assertEqual (r .status_code , 302 )
2053
+ self .assertEqual (len (outbox ), 2 )
2054
+ self .
assertIn (
"[email protected] " ,
outbox [
1 ][
"To" ])
2055
+ self .assertIn ("Call for adoption" , outbox [1 ]["Subject" ])
2056
+ body = get_payload_text (outbox [1 ])
2057
+ self .assertIn ("disclosure obligations" , body )
2058
+ self .assertIn ("starts a 2-week" , body )
2059
+
2060
+ # Test the less usual workflow of issuing a call for adoption
2061
+ # of a document that's already in the ietf stream
2062
+ draft = WgDraftFactory (group = role .group )
2063
+ url = urlreverse (
2064
+ "ietf.doc.views_draft.change_stream_state" ,
2065
+ kwargs = dict (name = draft .name , state_type = "draft-stream-ietf" ),
2066
+ )
2067
+ old_state = draft .get_state ("draft-stream-%s" % draft .stream_id )
2068
+ new_state = State .objects .get (
2069
+ used = True , type = "draft-stream-%s" % draft .stream_id , slug = "c-adopt"
2070
+ )
2071
+ self .assertNotEqual (old_state , new_state )
2072
+ empty_outbox ()
2073
+ r = self .client .post (
2074
+ url ,
2075
+ dict (
2076
+ new_state = new_state .pk ,
2077
+ comment = "some comment" ,
2078
+ weeks = "10" ,
2079
+ tags = [
2080
+ t .pk
2081
+ for t in draft .tags .filter (
2082
+ slug__in = get_tags_for_stream_id (draft .stream_id )
2083
+ )
2084
+ ],
2085
+ ),
2086
+ )
2087
+ self .assertEqual (r .status_code , 302 )
2088
+ self .assertEqual (len (outbox ), 2 )
2089
+ self .
assertIn (
"[email protected] " ,
outbox [
1 ][
"To" ])
2090
+ self .assertIn ("Call for adoption" , outbox [1 ]["Subject" ])
2091
+ body = get_payload_text (outbox [1 ])
2092
+ self .assertIn ("disclosure obligations" , body )
2093
+ self .assertIn ("starts a 10-week" , body )
2094
+ draft = WgDraftFactory (group = role .group )
2095
+ url = urlreverse (
2096
+ "ietf.doc.views_draft.change_stream_state" ,
2097
+ kwargs = dict (name = draft .name , state_type = "draft-stream-ietf" ),
2098
+ )
2099
+ old_state = draft .get_state ("draft-stream-%s" % draft .stream_id )
2100
+ new_state = State .objects .get (
2101
+ used = True , type = "draft-stream-%s" % draft .stream_id , slug = "c-adopt"
2102
+ )
2103
+ self .assertNotEqual (old_state , new_state )
2104
+ empty_outbox ()
2105
+ r = self .client .post (
2106
+ url ,
2107
+ dict (
2108
+ new_state = new_state .pk ,
2109
+ comment = "some comment" ,
2110
+ tags = [
2111
+ t .pk
2112
+ for t in draft .tags .filter (
2113
+ slug__in = get_tags_for_stream_id (draft .stream_id )
2114
+ )
2115
+ ],
2116
+ ),
2117
+ )
2118
+ self .assertEqual (r .status_code , 302 )
2119
+ self .assertEqual (len (outbox ), 2 )
2120
+ self .
assertIn (
"[email protected] " ,
outbox [
1 ][
"To" ])
2121
+ self .assertIn ("Call for adoption" , outbox [1 ]["Subject" ])
2122
+ body = get_payload_text (outbox [1 ])
2123
+ self .assertIn ("disclosure obligations" , body )
2124
+ self .assertIn ("starts a 2-week" , body )
2125
+
2126
+ def test_wg_last_call_issued (self ):
2127
+ role = RoleFactory (
2128
+ name_id = "chair" ,
2129
+ group__acronym = "mars" ,
2130
+ group__list_email = "[email protected] " ,
2131
+ person__user__username = "marschairman" ,
2132
+ person__name = "WG Cháir Man" ,
2133
+ )
2134
+ draft = WgDraftFactory (group = role .group )
2135
+ url = urlreverse (
2136
+ "ietf.doc.views_draft.change_stream_state" ,
2137
+ kwargs = dict (name = draft .name , state_type = "draft-stream-ietf" ),
2138
+ )
2139
+ login_testing_unauthorized (self , "marschairman" , url )
2140
+ old_state = draft .get_state ("draft-stream-%s" % draft .stream_id )
2141
+ new_state = State .objects .get (
2142
+ used = True , type = "draft-stream-%s" % draft .stream_id , slug = "wg-lc"
2143
+ )
2144
+ self .assertNotEqual (old_state , new_state )
2145
+ empty_outbox ()
2146
+ r = self .client .post (
2147
+ url ,
2148
+ dict (
2149
+ new_state = new_state .pk ,
2150
+ comment = "some comment" ,
2151
+ weeks = "10" ,
2152
+ tags = [
2153
+ t .pk
2154
+ for t in draft .tags .filter (
2155
+ slug__in = get_tags_for_stream_id (draft .stream_id )
2156
+ )
2157
+ ],
2158
+ ),
2159
+ )
2160
+ self .assertEqual (r .status_code , 302 )
2161
+ self .assertEqual (len (outbox ), 2 )
2162
+ self .
assertIn (
"[email protected] " ,
outbox [
1 ][
"To" ])
2163
+ self .assertIn ("WG Last Call" , outbox [1 ]["Subject" ])
2164
+ body = get_payload_text (outbox [1 ])
2165
+ self .assertIn ("disclosure obligations" , body )
2166
+ self .assertIn ("starts a 10-week" , body )
2167
+ draft = WgDraftFactory (group = role .group )
2168
+ url = urlreverse (
2169
+ "ietf.doc.views_draft.change_stream_state" ,
2170
+ kwargs = dict (name = draft .name , state_type = "draft-stream-ietf" ),
2171
+ )
2172
+ old_state = draft .get_state ("draft-stream-%s" % draft .stream_id )
2173
+ new_state = State .objects .get (
2174
+ used = True , type = "draft-stream-%s" % draft .stream_id , slug = "wg-lc"
2175
+ )
2176
+ self .assertNotEqual (old_state , new_state )
2177
+ empty_outbox ()
2178
+ r = self .client .post (
2179
+ url ,
2180
+ dict (
2181
+ new_state = new_state .pk ,
2182
+ comment = "some comment" ,
2183
+ tags = [
2184
+ t .pk
2185
+ for t in draft .tags .filter (
2186
+ slug__in = get_tags_for_stream_id (draft .stream_id )
2187
+ )
2188
+ ],
2189
+ ),
2190
+ )
2191
+ self .assertEqual (r .status_code , 302 )
2192
+ self .assertEqual (len (outbox ), 2 )
2193
+ self .
assertIn (
"[email protected] " ,
outbox [
1 ][
"To" ])
2194
+ self .assertIn ("WG Last Call" , outbox [1 ]["Subject" ])
2195
+ body = get_payload_text (outbox [1 ])
2196
+ self .assertIn ("disclosure obligations" , body )
2197
+ self .assertIn ("starts a 2-week" , body )
2198
+
2004
2199
def test_pubreq_validation (self ):
2005
2200
role = RoleFactory (
name_id = 'chair' ,
group__acronym = 'mars' ,
group__list_email = '[email protected] ' ,
person__user__username = 'marschairman' ,
person__name = 'WG Cháir Man' )
2006
2201
RoleFactory (
name_id = 'delegate' ,
group = role .
group ,
person__user__email = '[email protected] ' )
0 commit comments