@@ -35,13 +35,13 @@ def test_01_create_remote(self):
3535 """
3636 body = _gen_verbose_remote ()
3737 type(self ).remote = self .client .post (PYTHON_REMOTE_PATH , body )
38- for key in (' username' , ' password' ):
38+ for key in (" username" , " password" ):
3939 del body [key ]
4040 for key , val in body .items ():
4141 with self .subTest (key = key ):
4242 self .assertEqual (self .remote [key ], val )
4343
44- @skip_if (bool , ' remote' , False )
44+ @skip_if (bool , " remote" , False )
4545 def test_02_create_same_name (self ):
4646 """
4747 Try to create a second remote with an identical name.
@@ -50,69 +50,67 @@ def test_02_create_same_name(self):
5050 <https://github.com/PulpQE/pulp-smash/issues/1055>`_.
5151 """
5252 body = _gen_verbose_remote ()
53- body [' name' ] = self .remote [' name' ]
53+ body [" name" ] = self .remote [" name" ]
5454 with self .assertRaises (HTTPError ):
5555 self .client .post (PYTHON_REMOTE_PATH , body )
5656
57- @skip_if (bool , ' remote' , False )
57+ @skip_if (bool , " remote" , False )
5858 def test_02_read_remote (self ):
5959 """
6060 Read a remote by its href.
6161 """
62- remote = self .client .get (self .remote [' pulp_href' ])
62+ remote = self .client .get (self .remote [" pulp_href" ])
6363 for key , val in self .remote .items ():
6464 with self .subTest (key = key ):
6565 self .assertEqual (remote [key ], val )
6666
67- @skip_if (bool , ' remote' , False )
67+ @skip_if (bool , " remote" , False )
6868 def test_02_read_remotes (self ):
6969 """
7070 Read a remote by its name.
7171 """
72- page = self .client .get (PYTHON_REMOTE_PATH , params = {
73- 'name' : self .remote ['name' ]
74- })
75- self .assertEqual (len (page ['results' ]), 1 )
72+ page = self .client .get (PYTHON_REMOTE_PATH , params = {"name" : self .remote ["name" ]})
73+ self .assertEqual (len (page ["results" ]), 1 )
7674 for key , val in self .remote .items ():
7775 with self .subTest (key = key ):
78- self .assertEqual (page [' results' ][0 ][key ], val )
76+ self .assertEqual (page [" results" ][0 ][key ], val )
7977
80- @skip_if (bool , ' remote' , False )
78+ @skip_if (bool , " remote" , False )
8179 def test_03_partially_update (self ):
8280 """
8381 Update a remote using HTTP PATCH.
8482 """
8583 body = _gen_verbose_remote ()
86- self .client .patch (self .remote [' pulp_href' ], body )
87- for key in (' username' , ' password' ):
84+ self .client .patch (self .remote [" pulp_href" ], body )
85+ for key in (" username" , " password" ):
8886 del body [key ]
89- type(self ).remote = self .client .get (self .remote [' pulp_href' ])
87+ type(self ).remote = self .client .get (self .remote [" pulp_href" ])
9088 for key , val in body .items ():
9189 with self .subTest (key = key ):
9290 self .assertEqual (self .remote [key ], val )
9391
94- @skip_if (bool , ' remote' , False )
92+ @skip_if (bool , " remote" , False )
9593 def test_04_fully_update (self ):
9694 """
9795 Update a remote using HTTP PUT.
9896 """
9997 body = _gen_verbose_remote ()
100- self .client .put (self .remote [' pulp_href' ], body )
101- for key in (' username' , ' password' ):
98+ self .client .put (self .remote [" pulp_href" ], body )
99+ for key in (" username" , " password" ):
102100 del body [key ]
103- type(self ).remote = self .client .get (self .remote [' pulp_href' ])
101+ type(self ).remote = self .client .get (self .remote [" pulp_href" ])
104102 for key , val in body .items ():
105103 with self .subTest (key = key ):
106104 self .assertEqual (self .remote [key ], val )
107105
108- @skip_if (bool , ' remote' , False )
106+ @skip_if (bool , " remote" , False )
109107 def test_05_delete (self ):
110108 """
111109 Delete a remote.
112110 """
113- self .client .delete (self .remote [' pulp_href' ])
111+ self .client .delete (self .remote [" pulp_href" ])
114112 with self .assertRaises (HTTPError ):
115- self .client .get (self .remote [' pulp_href' ])
113+ self .client .get (self .remote [" pulp_href" ])
116114
117115
118116class CreateRemoteNoURLTestCase (unittest .TestCase ):
@@ -131,7 +129,7 @@ def test_all(self):
131129
132130 """
133131 body = gen_python_remote (utils .uuid4 ())
134- del body [' url' ]
132+ del body [" url" ]
135133 with self .assertRaises (HTTPError ):
136134 api .Client (config .get_config ()).post (PYTHON_REMOTE_PATH , body )
137135
@@ -149,11 +147,13 @@ def _gen_verbose_remote():
149147
150148 """
151149 attrs = gen_python_remote ()
152- attrs .update ({
153- 'password' : utils .uuid4 (),
154- 'policy' : random .choice (ON_DEMAND_DOWNLOAD_POLICIES ),
155- 'username' : utils .uuid4 (),
156- })
150+ attrs .update (
151+ {
152+ "password" : utils .uuid4 (),
153+ "policy" : random .choice (ON_DEMAND_DOWNLOAD_POLICIES ),
154+ "username" : utils .uuid4 (),
155+ }
156+ )
157157 return attrs
158158
159159
@@ -222,22 +222,21 @@ def test_includes_with_no_version(self):
222222 """
223223 body = gen_python_remote (includes = PYTHON_VALID_SPECIFIER_NO_VERSION )
224224 remote = self .client .post (PYTHON_REMOTE_PATH , body )
225- self .addCleanup (self .client .delete , remote [' pulp_href' ])
225+ self .addCleanup (self .client .delete , remote [" pulp_href" ])
226226
227- self .assertEqual (remote [' includes' ][0 ][' version_specifier' ], "" )
227+ self .assertEqual (remote [" includes" ][0 ][" version_specifier" ], "" )
228228
229229 def test_excludes_with_no_version (self ):
230230 """
231231 Test an exclude specifier without a "version_specifier" field.
232232 """
233233 body = gen_python_remote (excludes = PYTHON_VALID_SPECIFIER_NO_VERSION )
234234 remote = self .client .post (PYTHON_REMOTE_PATH , body )
235- self .addCleanup (self .client .delete , remote [' pulp_href' ])
235+ self .addCleanup (self .client .delete , remote [" pulp_href" ])
236236
237- self .assertEqual (remote [' includes' ][0 ][' version_specifier' ], "" )
237+ self .assertEqual (remote [" includes" ][0 ][" version_specifier" ], "" )
238238
239239
240- @unittest .skip ("Broken due to potential DRF issue?" )
241240class UpdateRemoteWithInvalidProjectSpecifiersTestCase (unittest .TestCase ):
242241 """
243242 Test that updating a remote with an invalid project specifier fails non-destructively.
@@ -259,44 +258,38 @@ def tearDownClass(cls):
259258 """
260259 Clean class-wide variable.
261260 """
262- cls .client .delete (cls .remote [' pulp_href' ])
261+ cls .client .delete (cls .remote [" pulp_href" ])
263262
263+ @unittest .skip ("Broken due to potential DRF issue?" )
264264 def test_includes_with_no_name (self ):
265265 """
266266 Test an include specifier without a "name" field.
267267 """
268268 body = {"includes" : PYTHON_INVALID_SPECIFIER_NO_NAME }
269- task_href = self .client .patch (self .remote ['pulp_href' ], body )
270- update_task = (task for task in api .poll_task (self .cfg , task_href ))[0 ]
271- self .assertEqual (update_task ['state' ], 'failed' )
272- self .assertDictEqual (self .client .get (self .remote ['pulp_href' ]), self ._original_remote )
269+ with self .assertRaises (HTTPError ):
270+ self .client .patch (self .remote ["pulp_href" ], body )
273271
274272 def test_includes_with_bad_version (self ):
275273 """
276274 Test an include specifier with an invalid "version_specifier" field value.
277275 """
278276 body = {"includes" : PYTHON_INVALID_SPECIFIER_BAD_VERSION }
279- task_href = self .client .patch (self .remote ['pulp_href' ], body )
280- update_task = (task for task in api .poll_task (self .cfg , task_href ))[0 ]
281- self .assertEqual (update_task ['state' ], 'failed' )
282- self .assertDictEqual (self .client .get (self .remote ['pulp_href' ]), self ._original_remote )
277+ with self .assertRaises (HTTPError ):
278+ self .client .patch (self .remote ["pulp_href" ], body )
283279
280+ @unittest .skip ("Broken due to potential DRF issue?" )
284281 def test_excludes_with_no_name (self ):
285282 """
286283 Test an exclude specifier without a "name" field.
287284 """
288285 body = {"excludes" : PYTHON_INVALID_SPECIFIER_NO_NAME }
289- task_href = self .client .patch (self .remote ['pulp_href' ], body )
290- update_task = (task for task in api .poll_task (self .cfg , task_href ))[0 ]
291- self .assertEqual (update_task ['state' ], 'failed' )
292- self .assertDictEqual (self .client .get (self .remote ['pulp_href' ]), self ._original_remote )
286+ with self .assertRaises (HTTPError ):
287+ self .client .patch (self .remote ["pulp_href" ], body )
293288
294289 def test_excludes_with_bad_version (self ):
295290 """
296291 Test an exclude specifier with an invalid "version_specifier" field value.
297292 """
298293 body = {"excludes" : PYTHON_INVALID_SPECIFIER_BAD_VERSION }
299- task_href = self .client .patch (self .remote ['pulp_href' ], body )
300- update_task = (task for task in api .poll_task (self .cfg , task_href ))[0 ]
301- self .assertEqual (update_task ['state' ], 'failed' )
302- self .assertDictEqual (self .client .get (self .remote ['pulp_href' ]), self ._original_remote )
294+ with self .assertRaises (HTTPError ):
295+ self .client .patch (self .remote ["pulp_href" ], body )
0 commit comments