Пример #1
0
 def test_fails_second_time(self):
     self.raw_api.do_it.side_effect = [
         InvalidAuthToken('message', 'code'),
         InvalidAuthToken('message', 'code'),
     ]
     with self.assertRaises(InvalidAuthToken):
         self.session.do_it()
Пример #2
0
 def __call__(self, *args, **kwargs):
     if self.__called:
         return self.__original_function(*args, **kwargs)
     self.__called = True
     raise InvalidAuthToken('message', 401)
Пример #3
0
 def test_works_second_time(self):
     self.raw_api.do_it.side_effect = [
         InvalidAuthToken('message', 'code'),
         'ok',
     ]
     self.assertEqual('ok', self.session.do_it())