Skip to content

Commit

Permalink
feat(api): partly continue api method
Browse files Browse the repository at this point in the history
  • Loading branch information
salemsd committed Jan 6, 2025
1 parent 83d77ac commit f5653ba
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions tests/antares/services/api_services/test_study_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions tests/antares/services/local_services/test_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/test_web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit f5653ba

Please sign in to comment.