Skip to content

Commit e746feb

Browse files
author
octavia-squidington-iii
committed
Auto-fix lint and format issues
1 parent b4ce3fa commit e746feb

File tree

2 files changed

+28
-14
lines changed

2 files changed

+28
-14
lines changed

airbyte_cdk/test/mock_http/response_builder.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,10 @@ def find_template(resource: str, execution_folder: str) -> Dict[str, Any]:
197197
with open(response_template_filepath, "r") as template_file:
198198
return json.load(template_file) # type: ignore # we assume the dev correctly set up the resource file
199199

200+
200201
def find_binary_response(resource: str, execution_folder: str) -> bytes:
201202
response_filepath = str(
202-
get_unit_test_folder(execution_folder)
203-
/ "resource"
204-
/ "http"
205-
/ "response"
206-
/ f"{resource}"
203+
get_unit_test_folder(execution_folder) / "resource" / "http" / "response" / f"{resource}"
207204
)
208205
with open(response_filepath, "rb") as response_file:
209206
return response_file.read() # type: ignore # we assume the dev correctly set up the resource file

unit_tests/sources/declarative/file/test_file_stream.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ def discover(config_builder: ConfigBuilder, expecting_exception: bool = False) -
6565
_source(CatalogBuilder().build(), config), config, expecting_exception
6666
)
6767

68+
6869
SERVER_URL = "https://d3v-airbyte.zendesk.com"
69-
STREAM_URL = f'{SERVER_URL}/api/v2/help_center/incremental/articles?start_time=1672531200'
70-
STREAM_ATTACHMENTS_URL = f'{SERVER_URL}/api/v2/help_center/articles/12138789487375/attachments?per_page=100&=1672531200'
71-
STREAM_ATTACHMENT_CONTENT_URL = f'{SERVER_URL}/hc/article_attachments/12138758717583'
70+
STREAM_URL = f"{SERVER_URL}/api/v2/help_center/incremental/articles?start_time=1672531200"
71+
STREAM_ATTACHMENTS_URL = (
72+
f"{SERVER_URL}/api/v2/help_center/articles/12138789487375/attachments?per_page=100&=1672531200"
73+
)
74+
STREAM_ATTACHMENT_CONTENT_URL = f"{SERVER_URL}/hc/article_attachments/12138758717583"
75+
7276

7377
class FileStreamTest(TestCase):
7478
def _config(self) -> ConfigBuilder:
@@ -115,11 +119,15 @@ def test_get_article_attachments(self) -> None:
115119
)
116120
http_mocker.get(
117121
HttpRequest(url=STREAM_ATTACHMENTS_URL),
118-
HttpResponse(json.dumps(find_template("file_api/article_attachments", __file__)), 200),
122+
HttpResponse(
123+
json.dumps(find_template("file_api/article_attachments", __file__)), 200
124+
),
119125
)
120126
http_mocker.get(
121127
HttpRequest(url=STREAM_ATTACHMENT_CONTENT_URL),
122-
HttpResponse(find_binary_response("file_api/article_attachment_content.png", __file__), 200),
128+
HttpResponse(
129+
find_binary_response("file_api/article_attachment_content.png", __file__), 200
130+
),
123131
)
124132

125133
output = read(
@@ -133,7 +141,9 @@ def test_get_article_attachments(self) -> None:
133141
file_reference = output.records[0].record.file_reference
134142
assert file_reference
135143
assert file_reference.staging_file_url
136-
assert re.match(r"^.*/article_attachments/[0-9a-fA-F-]{36}$", file_reference.staging_file_url)
144+
assert re.match(
145+
r"^.*/article_attachments/[0-9a-fA-F-]{36}$", file_reference.staging_file_url
146+
)
137147
assert file_reference.source_file_relative_path
138148
assert re.match(
139149
r"^article_attachments/[0-9a-fA-F-]{36}$", file_reference.source_file_relative_path
@@ -148,11 +158,15 @@ def test_get_article_attachments_with_filename_extractor(self) -> None:
148158
)
149159
http_mocker.get(
150160
HttpRequest(url=STREAM_ATTACHMENTS_URL),
151-
HttpResponse(json.dumps(find_template("file_api/article_attachments", __file__)), 200),
161+
HttpResponse(
162+
json.dumps(find_template("file_api/article_attachments", __file__)), 200
163+
),
152164
)
153165
http_mocker.get(
154166
HttpRequest(url=STREAM_ATTACHMENT_CONTENT_URL),
155-
HttpResponse(find_binary_response("file_api/article_attachment_content.png", __file__), 200),
167+
HttpResponse(
168+
find_binary_response("file_api/article_attachment_content.png", __file__), 200
169+
),
156170
)
157171

158172
output = read(
@@ -166,7 +180,10 @@ def test_get_article_attachments_with_filename_extractor(self) -> None:
166180
assert output.records
167181
file_reference = output.records[0].record.file_reference
168182
assert file_reference
169-
assert file_reference.staging_file_url == '/tmp/airbyte-file-transfer/article_attachments/12138758717583/some_image_name.png'
183+
assert (
184+
file_reference.staging_file_url
185+
== "/tmp/airbyte-file-transfer/article_attachments/12138758717583/some_image_name.png"
186+
)
170187
assert file_reference.source_file_relative_path
171188
assert not re.match(
172189
r"^article_attachments/[0-9a-fA-F-]{36}$", file_reference.source_file_relative_path

0 commit comments

Comments
 (0)