Skip to content

Commit

Permalink
Merge pull request #130 from matrop/feat-bundesanzeiger-connection-un…
Browse files Browse the repository at this point in the history
…it-tests

Add unit tests for Bundesanzeiger.__get_response()
  • Loading branch information
wirthual authored Nov 20, 2023
2 parents e421948 + 10dd9dc commit 4081447
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/bundesanzeiger/test_connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import pytest
from deutschland.bundesanzeiger import Bundesanzeiger


def test_exception_on_invalid_http_code():
ba = Bundesanzeiger()
with pytest.raises(ConnectionError):
ba._Bundesanzeiger__get_response("https://httpstat.us/500")
ba._Bundesanzeiger__get_response("https://httpstat.us/503")
ba._Bundesanzeiger__get_response("https://httpstat.us/404")


def test_get_response():
ba = Bundesanzeiger()
assert (
ba._Bundesanzeiger__get_response("https://httpstat.us/200").status_code == 200
)

0 comments on commit 4081447

Please sign in to comment.