def test_not_cached_bug(self): """Fetch bug information and cache it.""" bug = {'id': 4242} get_bug_data = self.BZReader.return_value.get_bug_data get_bug_data.return_value = bug credentials = { 'user': self.settings.username, 'password': self.settings.password } with mock.patch.dict('robozilla.decorators._bugzilla', {}): self.assertIs( robozilla_decorators._get_bugzilla_bug( bug['id'], bz_credentials=credentials), bug) self.BZReader.assert_called_once_with(credentials, include_fields=[ 'id', 'status', 'whiteboard', 'flags', 'resolution', 'target_milestone' ], follow_clones=True, follow_duplicates=True) get_bug_data.assert_called_once_with(bug['id'])
def test_not_cached_bug(self): """Fetch bug information and cache it.""" bug = {'id': 4242} get_bug_data = self.BZReader.return_value.get_bug_data get_bug_data.return_value = bug credentials = { 'user': self.settings.username, 'password': self.settings.password} with mock.patch.dict('robozilla.decorators._bugzilla', {}): self.assertIs( robozilla_decorators._get_bugzilla_bug( bug['id'], bz_credentials=credentials ), bug ) self.BZReader.assert_called_once_with( credentials, include_fields=[ 'id', 'status', 'whiteboard', 'flags', 'resolution', 'target_milestone' ], follow_clones=True ) get_bug_data.assert_called_once_with(bug['id'])
def test_cached(self): """Return bug information from the cache.""" with mock.patch.dict('robozilla.decorators._bugzilla', {'4242': 42}): self.assertEqual(robozilla_decorators._get_bugzilla_bug('4242'), 42)
def test_cached(self): """Return bug information from the cache.""" with mock.patch.dict('robozilla.decorators._bugzilla', {'4242': 42}): self.assertEqual( robozilla_decorators._get_bugzilla_bug('4242'), 42)