diff --git a/src/antares/craft/service/api_services/binding_constraint_api.py b/src/antares/craft/service/api_services/binding_constraint_api.py index 88a7fd4f..f33732b3 100644 --- a/src/antares/craft/service/api_services/binding_constraint_api.py +++ b/src/antares/craft/service/api_services/binding_constraint_api.py @@ -175,5 +175,7 @@ def read_binding_constraints(self) -> list[BindingConstraint]: url = f"{self._base_url}/studies/{self.study_id}/bindingconstraints" try: response = self._wrapper.get(url) + constraints_json = response.json() + create_bindin except APIError as e: raise ConstraintRetrievalError(self.study_id, e.message) from e diff --git a/tests/antares/services/api_services/test_study_api.py b/tests/antares/services/api_services/test_study_api.py index 1e646651..aff9f77a 100644 --- a/tests/antares/services/api_services/test_study_api.py +++ b/tests/antares/services/api_services/test_study_api.py @@ -472,3 +472,7 @@ def test_read_outputs(self): mocker.get(run_url, json={"description": error_message}, status_code=404) with pytest.raises(OutputsRetrievalError, match=error_message): self.study.read_outputs() + + def test_read_constraints(self): + with requests_mock.Mocker() as mocker: + run_url = f"https://antares.com/api/v1/studies/{self.study_id}/bindingconstraints" diff --git a/tests/antares/services/local_services/test_study.py b/tests/antares/services/local_services/test_study.py index 3ad09a0e..5a3cca6e 100644 --- a/tests/antares/services/local_services/test_study.py +++ b/tests/antares/services/local_services/test_study.py @@ -2240,8 +2240,8 @@ def test_submitted_time_series_is_saved(self, local_study): assert actual_time_series.equals(expected_time_series) def test_get_constraint_matrix(self, local_study): - # Given - expected_time_series = pd.DataFrame(np.random.random([365 * 24, 1])) + # Giveni + expected_time_seres = pd.DataFrame(np.random.random([365 * 24, 1])) bc_name = "test time series" local_study.create_binding_constraint( name=bc_name, diff --git a/tests/integration/test_web_client.py b/tests/integration/test_web_client.py index c0b3954b..edd10d55 100644 --- a/tests/integration/test_web_client.py +++ b/tests/integration/test_web_client.py @@ -526,3 +526,8 @@ def test_creation_lifecycle(self, antares_web: AntaresWebDesktop): assert not outputs.get(output.name).archived study_with_outputs = read_study_api(api_config, study._study_service.study_id) assert study_with_outputs.get_outputs() == outputs + + # ===== Test read binding constraints ===== + + constraints = study.read_binding_constraints() + print(1) \ No newline at end of file