Skip to content

Commit 1a08ac3

Browse files
committed
unit - scrapy utils
1 parent 251d37d commit 1a08ac3

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

tests/unit/scrapy/utils/test_apply_apify_settings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
from apify.scrapy.utils import apply_apify_settings
66

77

8-
def test__apply_apify_settings__overrides_scheduler() -> None:
8+
def test_overrides_scheduler() -> None:
99
settings = Settings()
1010
new_settings = apply_apify_settings(settings=settings)
1111

1212
assert new_settings.get('SCHEDULER') == 'apify.scrapy.scheduler.ApifyScheduler'
1313

1414

15-
def test__apply_apify_settings__update_item_pipelines() -> None:
15+
def test_updates_item_pipelines() -> None:
1616
settings = Settings(
1717
{
1818
'ITEM_PIPELINES': {
@@ -28,7 +28,7 @@ def test__apply_apify_settings__update_item_pipelines() -> None:
2828
}
2929

3030

31-
def test__apply_apify_settings__update_downloader_middlewares() -> None:
31+
def test_updates_downloader_middlewares() -> None:
3232
settings = Settings(
3333
{
3434
'DOWNLOADER_MIDDLEWARES': {
@@ -49,7 +49,7 @@ def test__apply_apify_settings__update_downloader_middlewares() -> None:
4949
}
5050

5151

52-
def test__apply_apify_settings__add_proxy_config() -> None:
52+
def test_adds_proxy_config() -> None:
5353
settings = Settings()
5454
new_settings = apply_apify_settings(settings=settings)
5555
assert new_settings.get('APIFY_PROXY_SETTINGS') is None

tests/unit/scrapy/utils/test_get_basic_auth_header.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ class TestCase:
1414
expected_auth_header: bytes
1515

1616

17-
test_cases = [
18-
TestCase('username', 'password', b'Basic dXNlcm5hbWU6cGFzc3dvcmQ='),
19-
TestCase('john_smith', 'secret_password_123', b'Basic am9obl9zbWl0aDpzZWNyZXRfcGFzc3dvcmRfMTIz'),
20-
]
21-
22-
23-
@pytest.mark.parametrize('tc', test_cases)
24-
def test__get_basic_auth_header(tc: TestCase) -> None:
17+
@pytest.mark.parametrize(
18+
'tc',
19+
[
20+
TestCase('username', 'password', b'Basic dXNlcm5hbWU6cGFzc3dvcmQ='),
21+
TestCase('john_smith', 'secret_password_123', b'Basic am9obl9zbWl0aDpzZWNyZXRfcGFzc3dvcmRfMTIz'),
22+
],
23+
ids=['simple_username_password', 'complex_username_password'],
24+
)
25+
def test_basic_auth_header_generation(tc: TestCase) -> None:
2526
auth_header = get_basic_auth_header(tc.username, tc.password)
2627
assert auth_header == tc.expected_auth_header

0 commit comments

Comments
 (0)