Patch timeutils from oslo_utils
The new version of oslo.db uses oslo_utils.timeutils to fill the `updated_at` column and similar ones, so we should mock timeutils from oslo_utils - not from oslo.utils - in tests to mock these values properly. Change-Id: I9931d6bc236bd84896164e9656eee2d06700d9d9
This commit is contained in:
parent
9739bc82fa
commit
ac803f6301
|
@ -138,7 +138,7 @@ class TestPatch(api_base.FunctionalTest):
|
|||
bay.save()
|
||||
return bay
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_replace_ok(self, mock_utcnow):
|
||||
name = 'bay_example_B'
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
|
@ -301,7 +301,7 @@ class TestPost(api_base.FunctionalTest):
|
|||
bay.create()
|
||||
return bay
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_create_bay(self, mock_utcnow):
|
||||
bdict = apiutils.bay_post_data()
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
|
|
|
@ -143,7 +143,7 @@ class TestPatch(api_base.FunctionalTest):
|
|||
self.assertEqual('application/json', response.content_type)
|
||||
self.assertTrue(response.json['error_message'])
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_replace_singular(self, mock_utcnow):
|
||||
name = 'bay_model_example_B'
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
|
@ -262,7 +262,7 @@ class TestPost(api_base.FunctionalTest):
|
|||
def setUp(self):
|
||||
super(TestPost, self).setUp()
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_create_baymodel(self, mock_utcnow):
|
||||
cdict = apiutils.baymodel_post_data()
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
|
|
|
@ -120,7 +120,7 @@ class TestPatch(api_base.FunctionalTest):
|
|||
super(TestPatch, self).setUp()
|
||||
self.node = obj_utils.create_test_node(self.context, image_id='Fedora')
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_replace_ok(self, mock_utcnow):
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
mock_utcnow.return_value = test_time
|
||||
|
@ -199,7 +199,7 @@ class TestPatch(api_base.FunctionalTest):
|
|||
|
||||
class TestPost(api_base.FunctionalTest):
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_create_node(self, mock_utcnow):
|
||||
node_dict = apiutils.node_post_data()
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
|
|
|
@ -129,7 +129,7 @@ class TestPatch(api_base.FunctionalTest):
|
|||
desc='pod_example_A_desc',
|
||||
status='Running')
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_replace_ok(self, mock_utcnow):
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
mock_utcnow.return_value = test_time
|
||||
|
@ -293,7 +293,7 @@ class TestPost(api_base.FunctionalTest):
|
|||
pod.create()
|
||||
return pod
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_create_pod(self, mock_utcnow):
|
||||
pdict = apiutils.pod_post_data()
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
|
|
|
@ -129,7 +129,7 @@ class TestPatch(api_base.FunctionalTest):
|
|||
self.rc = obj_utils.create_test_rc(self.context,
|
||||
images=['rc_example_A_image'])
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_replace_ok(self, mock_utcnow):
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
mock_utcnow.return_value = test_time
|
||||
|
@ -269,7 +269,7 @@ class TestPost(api_base.FunctionalTest):
|
|||
rc.create(self.context)
|
||||
return rc
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_create_rc(self, mock_utcnow):
|
||||
rc_dict = apiutils.rc_post_data()
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
|
|
|
@ -225,7 +225,7 @@ class TestPost(api_base.FunctionalTest):
|
|||
service.create()
|
||||
return service
|
||||
|
||||
@mock.patch('oslo.utils.timeutils.utcnow')
|
||||
@mock.patch('oslo_utils.timeutils.utcnow')
|
||||
def test_create_service(self, mock_utcnow):
|
||||
sdict = apiutils.service_post_data()
|
||||
test_time = datetime.datetime(2000, 1, 1, 0, 0)
|
||||
|
|
Loading…
Reference in New Issue