Skip to content

Commit

Permalink
tests: Add test to check GTFI doesn't raise
Browse files Browse the repository at this point in the history
  • Loading branch information
cdown committed May 8, 2019
1 parent 9d6c5f0 commit ff86993
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions tests/unit_tests.py
Expand Up @@ -13,8 +13,8 @@
)
from nose.tools import assert_raises, eq_ as eq, assert_true, assert_is_none, assert_in
from parameterized import parameterized
from hypothesis import given, settings
from hypothesis.strategies import sampled_from, none, one_of, text
from hypothesis import given, settings, assume
from hypothesis.strategies import sampled_from, none, one_of, text, integers


@httpretty.activate
Expand Down Expand Up @@ -53,6 +53,22 @@ def test_get_timezone_for_ip_empty_val(ip, service):
)


@httpretty.activate
@given(
one_of(IP_ADDRESSES, none()),
sampled_from(FAKE_SERVICES),
integers(min_value=400, max_value=599),
)
@settings(max_examples=20)
def test_get_timezone_for_ip_doesnt_raise(ip, service, status):
assume(status in httpretty.http.STATUSES)
fake_queue = mock.Mock()
setup_basic_api_response(status=status)
assert_is_none(
tzupdate.get_timezone_for_ip(ip=ip, service=service, queue_obj=fake_queue)
)


@mock.patch("tzupdate.os.unlink")
@mock.patch("tzupdate.os.symlink")
@mock.patch("tzupdate.os.path.isfile")
Expand Down

0 comments on commit ff86993

Please sign in to comment.