def test_invalid_service_ticket_does_not_grant_access(self): invalid_st = "invalid-service-ticket!" model = self._create_RegulationsPost_model() response = self._post_regulations(model, invalid_st) with self.assertRaises(ClientError): raise_on_error(response)
def _get_valid_regulation_id(self): service_ticket = self._get_service_ticket_for( self._pdb_service.regulations_service_id) model = self._pdb_service.create_RegulationsPost_model() response = self._pdb_service.create_regulation(model, service_ticket) raise_on_error(response) return self._pdb_service.get_reg_id_from_response(response)
def test_post_invalid_service_ticket_does_not_grant_access(self): invalid_st = "invalid-service-ticket!" reg_id = self._get_valid_regulation_id() response = self._post_regulation(reg_id, invalid_st) with self.assertRaises(ClientError): raise_on_error(response)
def test_invalid_data_is_client_error(self): """legislation_sector is marked as required. We should get a client error if it is not provided""" st = self._get_service_ticket() model = {"invalid": "model"} response = self._post_regulations(model, st) with self.assertRaises(ClientError): raise_on_error(response)
def test_post_regulation_invalid_data_is_client_error(self): """legislation_sector is marked as required. We should get a client error if it is not provided""" st = self._get_service_ticket( PoliciesDatabaseService.regulations_service_id) invalid_model = {"invalid": "model"} response = self._pdb_service.create_regulation(invalid_model, st) with self.assertRaises(ClientError): raise_on_error(response)