Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 11, 2024
1 parent 5270146 commit ed8a4dc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
9 changes: 6 additions & 3 deletions fivetran_provider_async/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,13 @@ def get_groups(self, group_id: str = "") -> dict:
resp = self._do_api_call("GET", endpoint)
return resp["data"]


def _get_groups(self) -> dict:
endpoint = self.api_path_groups
cursor = True
while cursor:
resp = self._do_api_call("GET", endpoint, params={"cursor": cursor} if isinstance(cursor, str) else None)
resp = self._do_api_call(
"GET", endpoint, params={"cursor": cursor} if isinstance(cursor, str) else None
)
cursor = resp["data"].get("next_cursor")
for group in resp["data"]["items"]:
yield group
Expand All @@ -288,7 +289,9 @@ def get_connectors(self, group_id: str) -> dict:
endpoint = f"{self.api_path_groups}{group_id}/connectors/"
cursor = True
while cursor:
resp = self._do_api_call("GET", endpoint, params={"cursor": cursor} if isinstance(cursor, str) else None)
resp = self._do_api_call(
"GET", endpoint, params={"cursor": cursor} if isinstance(cursor, str) else None
)
cursor = resp["data"].get("next_cursor")
for connector in resp["data"]["items"]:
yield connector
Expand Down
36 changes: 16 additions & 20 deletions tests/hooks/test_fivetran.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,15 @@
"code": "Success",
"data": {
"items": [
{
"id": "projected_sickle",
"name": "Staging",
"created_at": "2018-12-20T11:59:35.089589Z"
},
{"id": "projected_sickle", "name": "Staging", "created_at": "2018-12-20T11:59:35.089589Z"},
{
"id": "schoolmaster_heedless",
"name": "Production",
"created_at": "2019-01-08T19:53:52.185146Z"
}
"created_at": "2019-01-08T19:53:52.185146Z",
},
],
"next_cursor": "eyJza2lwIjoyfQ"
}
"next_cursor": "eyJza2lwIjoyfQ",
},
}

MOCK_FIVETRAN_GROUPS_RESPONSE_PAYLOAD_2 = {
Expand All @@ -169,7 +165,7 @@
"created_at": "2022-12-12T17:14:33.790844Z",
},
]
}
},
}

MOCK_FIVETRAN_CONNECTORS_RESPONSE_PAYLOAD_1 = {
Expand All @@ -193,8 +189,8 @@
"update_state": "delayed",
"is_historical_sync": False,
"tasks": [],
"warnings": []
}
"warnings": [],
},
},
{
"id": "wicked_impressive",
Expand All @@ -213,12 +209,12 @@
"update_state": "delayed",
"is_historical_sync": False,
"tasks": [],
"warnings": []
}
}
"warnings": [],
},
},
],
"next_cursor": "eyJza2lwIjoxfQ"
}
"next_cursor": "eyJza2lwIjoxfQ",
},
}

MOCK_FIVETRAN_CONNECTORS_RESPONSE_PAYLOAD_2 = {
Expand All @@ -242,11 +238,11 @@
"update_state": "delayed",
"is_historical_sync": False,
"tasks": [],
"warnings": []
}
"warnings": [],
},
}
]
}
},
}


Expand Down

0 comments on commit ed8a4dc

Please sign in to comment.