class TestBaseClientValidateResponse(unittest.TestCase): def setUp(self): self._client = BaseClient(ANY, uuid4(), ANY) def test_validate_response_on_api_response(self): response = APIResponse(MagicMock(), ANY, ANY) self._client._validate_response(response, MagicMock(spec=Schema)) def test_validate_response_on_other_response(self): response = MagicMock() self._client._validate_response(response, MagicMock(spec=Schema)) response.data.assert_not_called() def test_validation_failure(self): response = MagicMock() validator = MagicMock(spec=Schema) validator.to_python.side_effect = Invalid(ANY, ANY, ANY) with self.assertRaises(UnexpectedAPIResponse): self._client._validate_response(response, validator)
def setUp(self): self._client = BaseClient(ANY, uuid4(), ANY)
def test_invalid_entity_id(self): with self.assertRaises(InvalidEntityID): BaseClient(ANY, ANY, ANY)
def test_success(self): BaseClient(ANY, uuid4(), ANY)