Skip to content

Commit

Permalink
Add tests for function 'get_website_name'
Browse files Browse the repository at this point in the history
  • Loading branch information
Crinibus committed Sep 16, 2022
1 parent 9e6197f commit 713df95
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_domains.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import pytest

from scraper.domains import get_website_name

test_websites = [
("https://www.amazon.com/", "amazon"),
("https://www.komplett.dk/", "komplett"),
("https://www.av-cables.dk/", "av-cables"),
("https://nowww.com/", "nowww"),
("https://no-ending-slash.com", "no-ending-slash"),
("https://www.test.testing.com/", "test.testing"),
("https://www.test.hello.com/hello/world", "test.hello"),
]


@pytest.mark.parametrize("url,expected", test_websites)
def test_get_website_name(url, expected):
result = get_website_name(url)
assert result == expected

0 comments on commit 713df95

Please sign in to comment.