def test_return_none_if_task_doesnt_exist(self): with mock.patch('requests.get') as get: get.return_value = mock.Mock(status_code=404, content="Blah") m = Manoderecha('user', 'password') task = m.get_task('1') assert task is None
def test_gets_task(self, a_task): with mock.patch('requests.get') as get: get.return_value = a_task m = Manoderecha('user', 'password') task = m.get_task('1') # id from a_task fixture's JSON assert task['id'] == 1