def test_expect_atmost_once(self): self.client.expect(request(), response(), timesrange(atmost=1)) result = requests.get(MOCK_SERVER_URL + "/path") self.assertEqual(result.status_code, 200) self.client.verify_expectations()
def test_expect_atleast_twice_fails(self): self.client.expect(request(), response(), timesrange(atleast=2)) result = requests.get(MOCK_SERVER_URL + "/path") self.assertEqual(result.status_code, 200) with self.assertRaises(AssertionError): self.client.verify_expectations()