Created
August 13, 2012 21:41
-
-
Save dcramer/3344286 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mock.patch('modeldict.base.time') | |
def test_switch_creation(self, time_mod): | |
self.mydict['hello'] = 'foo' | |
self.assertEquals(self.cache.set.call_count, 2) | |
time_mod.time.return_value = 1344893511 | |
print time_mod.mock_calls | |
print self.cache.set.mock_calls | |
self.cache.set.assert_any_call(self.mydict.cache_key, {u'hello': u'foo'}) | |
self.cache.set.assert_any_call(self.mydict.last_updated_cache_key, time_mod.time.return_value) | |
AssertionError: set('ModelDict.last_updated:ModelDictModel:key', 1344893511) call not found | |
-------------------- >> begin captured stdout << --------------------- | |
<MagicMock name='time.time()' id='4525693200'> | |
[call.time(), call.time().__str__(), call.time(), call.time().__int__()] | |
[call('ModelDict:ModelDictModel:key', {u'hello': u'foo'}), | |
call('ModelDict.last_updated:ModelDictModel:key', 1)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment