def test_returns_400_if_missing_mandatory_data(self): self.broker.provision.side_effect = errors.ErrInvalidParameters( 'Required parameters not provided.') response = self.client.put("/v2/service_instances/abc", data=json.dumps({ "service_id": "service-guid-here", "plan_id": "plan-guid-here", "organization_guid": "org-guid-here", "space_guid": "space-guid-here", }), headers={ 'X-Broker-Api-Version': '2.13', 'Content-Type': 'application/json', 'Authorization': self.auth_header }) self.assertEqual(response.status_code, http.HTTPStatus.BAD_REQUEST) self.assertEqual( response.json, dict(error="InvalidParameters", description="Required parameters not provided."))
def last_operation(self, instance_id: str, operation_data: Optional[str], **kwargs) -> LastOperation: data = operation_data.split(' ', maxsplit=1) service_id = data[0] if len(data) == 2: operation_data = data[1] else: operation_data = None try: provider = self._get_provider_by_id(service_id) except KeyError as e: logger.exception(e) raise errors.ErrInvalidParameters('Invalid operation string') result = provider.last_operation(instance_id, operation_data, **kwargs) return result