Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gratcliff committed Sep 19, 2023
1 parent 5489536 commit fc3b7f6
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions packages/python/readme_metrics/tests/GetProjectBaseUrl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,24 @@ def json():
def raise_for_status(self):
if self.throw:
raise self.throw("oh no")
return


def FakeLogger():
return


@pytest.fixture(name="readme_api_v1_success")
def fixture_readme_api_v1_success(monkeypatch):
monkeypatch.setattr(requests, "get", lambda *_, **__: MockResponse())


@pytest.fixture(name="readme_api_v1_http_error")
def fixture_readme_api_v1_http_error(monkeypatch):
monkeypatch.setattr(
requests, "get", lambda *_, **__: MockResponse(throw=requests.HTTPError)
)


def test_get_project_base_url(readme_api_v1_success):
assert get_project_base_url("", "secretkey", 3, FakeLogger) == "https://zombo.com"

Expand All @@ -48,17 +59,5 @@ def test_get_project_base_url_exception(readme_api_v1_http_error):
try:
get_project_base_url("", "secretkey", 3, FakeLogger)
assert False
except: # pylint: disable=bare-except
# Do nothing


@pytest.fixture
def readme_api_v1_success(monkeypatch):
monkeypatch.setattr(requests, "get", lambda *_, **__: MockResponse())


@pytest.fixture
def readme_api_v1_http_error(monkeypatch):
monkeypatch.setattr(
requests, "get", lambda *_, **__: MockResponse(throw=requests.HTTPError)
)
except Exception:
assert True

0 comments on commit fc3b7f6

Please sign in to comment.