@@ -69,10 +69,11 @@ class TestBasicsForm(WizardTestCase):
69
69
70
70
def setUp (self ):
71
71
self .user = get (User )
72
- self .step_data ['basics' ] = {
73
- 'name' : 'foobar' ,
74
- 'repo' : 'http://example.com/foobar' ,
75
- 'repo_type' : 'git' ,
72
+ self .step_data ["basics" ] = {
73
+ "name" : "foobar" ,
74
+ "repo" : "http://example.com/foobar" ,
75
+ "repo_type" : "git" ,
76
+ "language" : "en" ,
76
77
}
77
78
self .step_data ["config" ] = {
78
79
"confirm" : True ,
@@ -199,10 +200,6 @@ def setUp(self):
199
200
}
200
201
201
202
def test_initial_params (self ):
202
- extra_initial = {
203
- 'description' : 'An amazing project' ,
204
- 'project_url' : "https://foo.bar" ,
205
- }
206
203
config_initial = {
207
204
"confirm" : True ,
208
205
}
@@ -213,7 +210,7 @@ def test_initial_params(self):
213
210
'default_branch' : 'main' ,
214
211
'remote_repository' : '' ,
215
212
}
216
- initial = dict (** extra_initial , ** config_initial , ** basic_initial )
213
+ initial = dict (** config_initial , ** basic_initial )
217
214
self .client .force_login (self .user )
218
215
219
216
# User selects a remote repo to import.
@@ -223,61 +220,17 @@ def test_initial_params(self):
223
220
form = resp .context_data ['form' ]
224
221
self .assertEqual (form .initial , basic_initial )
225
222
226
- # User selects advanced.
227
- basic_initial ['advanced' ] = True
228
- step_data = {
229
- f'basics-{ k } ' : v
230
- for k , v in basic_initial .items ()
231
- }
232
- step_data [f'{ self .wizard_class_slug } -current_step' ] = 'basics'
233
- resp = self .client .post (self .url , step_data )
234
-
235
- step_data = {f"config-{ k } " : v for k , v in config_initial .items ()}
236
- step_data [f"{ self .wizard_class_slug } -current_step" ] = "config"
237
- resp = self .client .post (self .url , step_data )
238
-
239
- # The correct initial data for the advanced form is set.
240
- form = resp .context_data ['form' ]
241
- self .assertEqual (form .initial , extra_initial )
242
-
243
223
def test_form_pass (self ):
244
224
"""Test all forms pass validation."""
245
225
resp = self .post_step ("basics" )
246
226
self .assertWizardResponse (resp , "config" )
247
227
resp = self .post_step ("config" , session = list (resp ._request .session .items ()))
248
- self .assertWizardResponse (resp , "extra" )
249
- self .assertEqual (resp .status_code , 200 )
250
- resp = self .post_step ('extra' , session = list (resp ._request .session .items ()))
251
228
self .assertIsInstance (resp , HttpResponseRedirect )
252
229
self .assertEqual (resp .status_code , 302 )
253
230
self .assertEqual (resp ['location' ], '/projects/foobar/' )
254
231
255
232
proj = Project .objects .get (name = 'foobar' )
256
233
self .assertIsNotNone (proj )
257
- data = self .step_data ['basics' ]
258
- del data ['advanced' ]
259
- del self .step_data ['extra' ]['tags' ]
260
- self .assertCountEqual (
261
- [tag .name for tag in proj .tags .all ()],
262
- ['bar' , 'baz' , 'foo' ],
263
- )
264
- data .update (self .step_data ['extra' ])
265
- for (key , val ) in list (data .items ()):
266
- self .assertEqual (getattr (proj , key ), val )
267
-
268
- def test_form_missing_extra (self ):
269
- """Submit extra form with missing data, expect to get failures."""
270
- # Remove extra data to trigger validation errors
271
- self .step_data ['extra' ] = {}
272
-
273
- resp = self .post_step ("basics" )
274
- self .assertWizardResponse (resp , "config" )
275
- resp = self .post_step ("config" , session = list (resp ._request .session .items ()))
276
- self .assertWizardResponse (resp , "extra" )
277
- resp = self .post_step ("extra" , session = list (resp ._request .session .items ()))
278
-
279
- self .assertWizardFailure (resp , 'language' )
280
- self .assertWizardFailure (resp , 'documentation_type' )
281
234
282
235
def test_remote_repository_is_added (self ):
283
236
remote_repo = get (RemoteRepository , default_branch = "default-branch" )
@@ -292,8 +245,6 @@ def test_remote_repository_is_added(self):
292
245
resp = self .post_step ("basics" )
293
246
self .assertWizardResponse (resp , "config" )
294
247
resp = self .post_step ("config" , session = list (resp ._request .session .items ()))
295
- self .assertWizardResponse (resp , "extra" )
296
- resp = self .post_step ("extra" , session = list (resp ._request .session .items ()))
297
248
self .assertIsInstance (resp , HttpResponseRedirect )
298
249
self .assertEqual (resp .status_code , 302 )
299
250
self .assertEqual (resp ['location' ], '/projects/foobar/' )
0 commit comments