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
This commit is contained in:
lin-hua-cheng 2015-07-10 00:11:18 -07:00 committed by Steve Martinelli
parent 35dc2bed9e
commit f807f0a66e
5 changed files with 6 additions and 6 deletions

View File

@ -42,8 +42,7 @@ class IdentityTests(test.TestCase):
auth_url = auth_url.replace('v2.0', 'v3')
os.environ['OS_AUTH_URL'] = auth_url
os.environ['OS_IDENTITY_API_VERSION'] = '3'
os.environ['OS_USER_DOMAIN_ID'] = 'default'
os.environ['OS_PROJECT_DOMAIN_ID'] = 'default'
os.environ['OS_AUTH_TYPE'] = 'v3password'
# create dummy domain
cls.domain_name = data_utils.rand_name('TestDomain')

View File

@ -250,7 +250,7 @@ class TestServerCreate(TestServer):
mock_open.assert_called_with('userdata.sh')
# Ensure the userdata file is closed
mock_file.close.assert_called()
mock_file.close.assert_called_with()
# Set expected values
kwargs = dict(

View File

@ -312,7 +312,7 @@ class TestQosList(TestQos):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
self.qos_mock.list.assert_called()
self.qos_mock.list.assert_called_with()
collist = (
'ID',

View File

@ -312,7 +312,7 @@ class TestQosList(TestQos):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
self.qos_mock.list.assert_called()
self.qos_mock.list.assert_called_with()
collist = (
'ID',

View File

@ -6,7 +6,8 @@ hacking<0.11,>=0.10.0
coverage>=3.6
discover
fixtures>=1.3.1
mock>=1.0
mock>=1.0;python_version!='2.6'
mock==1.0.1;python_version=='2.6'
oslosphinx>=2.5.0 # Apache-2.0
oslotest>=1.5.1 # Apache-2.0
requests-mock>=0.6.0 # Apache-2.0