Skip to content

Commit f807f0a

Browse files
lin-hua-chengSteve Martinelli
authored andcommitted
Fix wrong mock method call
There is no assert_called() method in mock, replace it with assert_called_with() method. The old method used to work with mock 1.0.1 because it was a noop in magicmock. Needs https://review.openstack.org/#/c/200583 to pass the requirements check. https://review.openstack.org/#/c/193935/ changed the OS_* vars we source by forcing v2password as the auth method. change our identity v3 test setup by setting v3password Co-Authored-By: Steve Martinelli <stevemar@ca.ibm.com> Closes-Bug: 1473454 Depends-on: I0cfab6d13e5d9e744cb302c86a2c21269923e75d Change-Id: Id22765c7e044797e03d19ad1b103fadec2726aa2
1 parent 35dc2be commit f807f0a

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎functional/tests/identity/v3/test_identity.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ def setUpClass(cls):
4242
auth_url = auth_url.replace('v2.0', 'v3')
4343
os.environ['OS_AUTH_URL'] = auth_url
4444
os.environ['OS_IDENTITY_API_VERSION'] = '3'
45-
os.environ['OS_USER_DOMAIN_ID'] = 'default'
46-
os.environ['OS_PROJECT_DOMAIN_ID'] = 'default'
45+
os.environ['OS_AUTH_TYPE'] = 'v3password'
4746

4847
# create dummy domain
4948
cls.domain_name = data_utils.rand_name('TestDomain')

‎openstackclient/tests/compute/v2/test_server.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def test_server_create_userdata(self, mock_open):
250250
mock_open.assert_called_with('userdata.sh')
251251

252252
# Ensure the userdata file is closed
253-
mock_file.close.assert_called()
253+
mock_file.close.assert_called_with()
254254

255255
# Set expected values
256256
kwargs = dict(

‎openstackclient/tests/volume/v1/test_qos_specs.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def test_qos_list(self):
312312
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
313313

314314
columns, data = self.cmd.take_action(parsed_args)
315-
self.qos_mock.list.assert_called()
315+
self.qos_mock.list.assert_called_with()
316316

317317
collist = (
318318
'ID',

‎openstackclient/tests/volume/v2/test_qos_specs.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def test_qos_list(self):
312312
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
313313

314314
columns, data = self.cmd.take_action(parsed_args)
315-
self.qos_mock.list.assert_called()
315+
self.qos_mock.list.assert_called_with()
316316

317317
collist = (
318318
'ID',

‎test-requirements.txt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ hacking<0.11,>=0.10.0
66
coverage>=3.6
77
discover
88
fixtures>=1.3.1
9-
mock>=1.0
9+
mock>=1.0;python_version!='2.6'
10+
mock==1.0.1;python_version=='2.6'
1011
oslosphinx>=2.5.0 # Apache-2.0
1112
oslotest>=1.5.1 # Apache-2.0
1213
requests-mock>=0.6.0 # Apache-2.0

0 commit comments

Comments
 (0)