Skip to content

Commit 1b27915

Browse files
authored
fix: Adjust the correlation tests (#57)
1 parent fc9a965 commit 1b27915

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

docs/content/grafana_api/correlations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The method includes a functionality to get all correlations from a data source -
8888
#### get\_all\_correlations
8989

9090
```python
91-
def get_all_correlations() -> list
91+
def get_all_correlations() -> Union[list, dict]
9292
```
9393

9494
The method includes a functionality to get all correlations
@@ -100,7 +100,7 @@ The method includes a functionality to get all correlations
100100

101101
**Returns**:
102102

103-
- `api_call` _list_ - Returns the corresponding correlations
103+
- `api_call` _Union[list, dict]_ - Returns the corresponding correlations
104104

105105
<a id="correlations.Correlations.create_correlations"></a>
106106

grafana_api/correlations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ def get_all_correlations_by_datasource_uid(self, datasource_uid: str) -> list:
7878
logging.error("There is no datasource_uid defined.")
7979
raise ValueError
8080

81-
def get_all_correlations(self) -> list:
81+
def get_all_correlations(self) -> Union[list, dict]:
8282
"""The method includes a functionality to get all correlations
8383
8484
Raises:
8585
Exception: Unspecified error by executing the API call
8686
8787
Returns:
88-
api_call (list): Returns the corresponding correlations
88+
api_call (Union[list, dict]): Returns the corresponding correlations
8989
"""
9090

9191
api_call: Union[list, dict] = Api(self.grafana_api_model).call_the_api(

tests/integrationtest/test_correlations.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,8 @@ def test_b_correlations_lifecycle(self):
5353
)
5454

5555
self.assertEqual(
56-
{
57-
"correlations": [correlation_object.get("result")],
58-
"limit": 100,
59-
"page": 1,
60-
"totalCount": 1,
61-
},
62-
self.correlations.get_all_correlations(),
56+
list([correlation_object.get("result")]),
57+
self.correlations.get_all_correlations().get("correlations"),
6358
)
6459

6560
self.assertEqual(
@@ -74,6 +69,7 @@ def test_b_correlations_lifecycle(self):
7469
)
7570

7671
def test_c_delete_data_source(self):
72+
pass
7773
self.assertEqual(
7874
None, self.data_source.delete_datasource_by_name("TestData DB 1")
7975
)

0 commit comments

Comments
 (0)