Don't use mock non-exist method assert_called_once

There isn't method assert_called_once of mock class
and hence does not really check anything. Let's use
assertEqual(1, mock.call_count) to check.

Change-Id: I2bdf62b775badc0adbe2c6f55bcc65cd13ac2d60
This commit is contained in:
ChangBo Guo(gcb)
2014-05-16 10:55:23 +08:00
parent 6663e1360d
commit 992e371e4d

View File

@@ -96,7 +96,7 @@ class KeyringTest(utils.TestCase):
self.assertTrue(cl.authenticate())
meth.assert_called_once()
self.assertEqual(1, meth.call_count)
# make sure that we never touched the keyring
self.assertFalse(self.memory_keyring.get_password_called)
@@ -134,7 +134,7 @@ class KeyringTest(utils.TestCase):
self.assertTrue(cl.authenticate())
meth.assert_called_once()
self.assertEqual(1, meth.call_count)
# check that a value was returned from the keyring
self.assertTrue(self.memory_keyring.fetched)
@@ -172,7 +172,7 @@ class KeyringTest(utils.TestCase):
self.assertTrue(cl.authenticate())
meth.assert_called_once()
self.assertEqual(1, meth.call_count)
# we checked the keyring, but we didn't find anything
self.assertTrue(self.memory_keyring.get_password_called)