Skip to content

Commit

Permalink
test: fix usage of tick function so g3 tests can pass (#507)
Browse files Browse the repository at this point in the history
  • Loading branch information
arithmetic1728 authored May 8, 2020
1 parent 7c9e8c2 commit 371b57c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/transport/test_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ def test_request_refresh(self):
assert adapter.requests[1].headers["authorization"] == "token1"

def test_request_max_allowed_time_timeout_error(self, frozen_time):
tick_one_second = functools.partial(frozen_time.tick, delta=1.0)
tick_one_second = functools.partial(
frozen_time.tick, delta=datetime.timedelta(seconds=1.0)
)

credentials = mock.Mock(
wraps=TimeTickCredentialsStub(time_tick=tick_one_second)
Expand All @@ -286,7 +288,9 @@ def test_request_max_allowed_time_timeout_error(self, frozen_time):
authed_session.request("GET", self.TEST_URL, max_allowed_time=0.9)

def test_request_max_allowed_time_w_transport_timeout_no_error(self, frozen_time):
tick_one_second = functools.partial(frozen_time.tick, delta=1.0)
tick_one_second = functools.partial(
frozen_time.tick, delta=datetime.timedelta(seconds=1.0)
)

credentials = mock.Mock(
wraps=TimeTickCredentialsStub(time_tick=tick_one_second)
Expand All @@ -308,7 +312,9 @@ def test_request_max_allowed_time_w_transport_timeout_no_error(self, frozen_time
authed_session.request("GET", self.TEST_URL, timeout=0.5, max_allowed_time=3.1)

def test_request_max_allowed_time_w_refresh_timeout_no_error(self, frozen_time):
tick_one_second = functools.partial(frozen_time.tick, delta=1.0)
tick_one_second = functools.partial(
frozen_time.tick, delta=datetime.timedelta(seconds=1.0)
)

credentials = mock.Mock(
wraps=TimeTickCredentialsStub(time_tick=tick_one_second)
Expand All @@ -333,7 +339,9 @@ def test_request_max_allowed_time_w_refresh_timeout_no_error(self, frozen_time):
authed_session.request("GET", self.TEST_URL, timeout=60, max_allowed_time=3.1)

def test_request_timeout_w_refresh_timeout_timeout_error(self, frozen_time):
tick_one_second = functools.partial(frozen_time.tick, delta=1.0)
tick_one_second = functools.partial(
frozen_time.tick, delta=datetime.timedelta(seconds=1.0)
)

credentials = mock.Mock(
wraps=TimeTickCredentialsStub(time_tick=tick_one_second)
Expand Down

0 comments on commit 371b57c

Please # to comment.