@@ -293,106 +293,79 @@ def _simulate_nodegroup_create(self, cluster, nodegroup):
293293 nodegroup .create ()
294294 return nodegroup
295295
296- @mock .patch ('oslo_utils.timeutils.utcnow' )
297- def test_create_nodegroup (self , mock_utcnow ):
296+ def test_create_nodegroup (self ):
298297 ng_dict = apiutils .nodegroup_post_data ()
299- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
300- mock_utcnow .return_value = test_time
301298
302299 response = self .post_json (self .url , ng_dict )
303300 self .assertEqual ('application/json' , response .content_type )
304301 self .assertEqual (202 , response .status_int )
305302 self .assertTrue (uuidutils .is_uuid_like (response .json ['uuid' ]))
306303 self .assertFalse (response .json ['is_default' ])
307304
308- @mock .patch ('oslo_utils.timeutils.utcnow' )
309- def test_create_nodegroup_without_node_count (self , mock_utcnow ):
305+ def test_create_nodegroup_without_node_count (self ):
310306 ng_dict = apiutils .nodegroup_post_data ()
311307 del ng_dict ['node_count' ]
312- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
313- mock_utcnow .return_value = test_time
314308
315309 response = self .post_json (self .url , ng_dict )
316310 self .assertEqual ('application/json' , response .content_type )
317311 self .assertEqual (202 , response .status_int )
318312 # Verify node_count defaults to 1
319313 self .assertEqual (1 , response .json ['node_count' ])
320314
321- @mock .patch ('oslo_utils.timeutils.utcnow' )
322- def test_create_nodegroup_with_zero_nodes (self , mock_utcnow ):
315+ def test_create_nodegroup_with_zero_nodes (self ):
323316 ng_dict = apiutils .nodegroup_post_data ()
324317 ng_dict ['node_count' ] = 0
325318 ng_dict ['min_node_count' ] = 0
326- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
327- mock_utcnow .return_value = test_time
328319
329320 response = self .post_json (self .url , ng_dict )
330321 self .assertEqual ('application/json' , response .content_type )
331322 self .assertEqual (202 , response .status_int )
332323 # Verify node_count is set to zero
333324 self .assertEqual (0 , response .json ['node_count' ])
334325
335- @mock .patch ('oslo_utils.timeutils.utcnow' )
336- def test_create_nodegroup_with_max_node_count (self , mock_utcnow ):
326+ def test_create_nodegroup_with_max_node_count (self ):
337327 ng_dict = apiutils .nodegroup_post_data (max_node_count = 5 )
338- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
339- mock_utcnow .return_value = test_time
340328
341329 response = self .post_json (self .url , ng_dict )
342330 self .assertEqual ('application/json' , response .content_type )
343331 self .assertEqual (202 , response .status_int )
344332 self .assertEqual (5 , response .json ['max_node_count' ])
345333
346- @mock .patch ('oslo_utils.timeutils.utcnow' )
347- def test_create_nodegroup_with_role (self , mock_utcnow ):
334+ def test_create_nodegroup_with_role (self ):
348335 ng_dict = apiutils .nodegroup_post_data (role = 'test-role' )
349- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
350- mock_utcnow .return_value = test_time
351336
352337 response = self .post_json (self .url , ng_dict )
353338 self .assertEqual ('application/json' , response .content_type )
354339 self .assertEqual (202 , response .status_int )
355340 self .assertEqual ('test-role' , response .json ['role' ])
356341
357- @mock .patch ('oslo_utils.timeutils.utcnow' )
358- def test_create_nodegroup_with_labels (self , mock_utcnow ):
342+ def test_create_nodegroup_with_labels (self ):
359343 labels = {'label1' : 'value1' }
360344 ng_dict = apiutils .nodegroup_post_data (labels = labels )
361- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
362- mock_utcnow .return_value = test_time
363345
364346 response = self .post_json (self .url , ng_dict )
365347 self .assertEqual ('application/json' , response .content_type )
366348 self .assertEqual (202 , response .status_int )
367349 self .assertEqual (labels , response .json ['labels' ])
368350
369- @mock .patch ('oslo_utils.timeutils.utcnow' )
370- def test_create_nodegroup_with_image_id (self , mock_utcnow ):
351+ def test_create_nodegroup_with_image_id (self ):
371352 ng_dict = apiutils .nodegroup_post_data (image_id = 'test_image' )
372- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
373- mock_utcnow .return_value = test_time
374353
375354 response = self .post_json (self .url , ng_dict )
376355 self .assertEqual ('application/json' , response .content_type )
377356 self .assertEqual (202 , response .status_int )
378357 self .assertEqual ('test_image' , response .json ['image_id' ])
379358
380- @mock .patch ('oslo_utils.timeutils.utcnow' )
381- def test_create_nodegroup_with_flavor (self , mock_utcnow ):
359+ def test_create_nodegroup_with_flavor (self ):
382360 ng_dict = apiutils .nodegroup_post_data (flavor_id = 'test_flavor' )
383- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
384- mock_utcnow .return_value = test_time
385361
386362 response = self .post_json (self .url , ng_dict )
387363 self .assertEqual ('application/json' , response .content_type )
388364 self .assertEqual (202 , response .status_int )
389365 self .assertEqual ('test_flavor' , response .json ['flavor_id' ])
390366
391- @mock .patch ('oslo_utils.timeutils.utcnow' )
392- def test_create_nodegroup_only_name (self , mock_utcnow ):
367+ def test_create_nodegroup_only_name (self ):
393368 ng_dict = {'name' : 'test_ng' }
394- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
395- mock_utcnow .return_value = test_time
396369
397370 response = self .post_json (self .url , ng_dict )
398371 self .assertEqual ('application/json' , response .content_type )
@@ -409,11 +382,8 @@ def test_create_nodegroup_only_name(self, mock_utcnow):
409382 self .assertEqual (1 , response .json ['node_count' ])
410383 self .assertIsNone (response .json ['max_node_count' ])
411384
412- @mock .patch ('oslo_utils.timeutils.utcnow' )
413- def test_create_nodegroup_invalid_node_count (self , mock_utcnow ):
385+ def test_create_nodegroup_invalid_node_count (self ):
414386 ng_dict = apiutils .nodegroup_post_data (node_count = 7 , max_node_count = 5 )
415- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
416- mock_utcnow .return_value = test_time
417387
418388 response = self .post_json (self .url , ng_dict , expect_errors = True )
419389 self .assertEqual ('application/json' , response .content_type )
@@ -710,23 +680,15 @@ def test_remove_min_node_count(self, mock_utcnow):
710680 response ['updated_at' ]).replace (tzinfo = None )
711681 self .assertEqual (test_time , return_updated_at )
712682
713- @mock .patch ('oslo_utils.timeutils.utcnow' )
714- def test_remove_internal_attr (self , mock_utcnow ):
715- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
716- mock_utcnow .return_value = test_time
717-
683+ def test_remove_internal_attr (self ):
718684 response = self .patch_json (self .url + self .nodegroup .name ,
719685 [{'path' : '/node_count' ,
720686 'op' : 'remove' }], expect_errors = True )
721687 self .assertEqual ('application/json' , response .content_type )
722688 self .assertEqual (400 , response .status_code )
723689 self .assertIsNotNone (response .json ['errors' ])
724690
725- @mock .patch ('oslo_utils.timeutils.utcnow' )
726- def test_remove_non_existent_property (self , mock_utcnow ):
727- test_time = datetime .datetime (2000 , 1 , 1 , 0 , 0 )
728- mock_utcnow .return_value = test_time
729-
691+ def test_remove_non_existent_property (self ):
730692 response = self .patch_json (self .url + self .nodegroup .name ,
731693 [{'path' : '/not_there' ,
732694 'op' : 'remove' }], expect_errors = True )
0 commit comments