Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Improving testing for when absent 'date' parameter
Browse files Browse the repository at this point in the history
The tests were too complicated and their names were unclear. We now only have one test which just checks what it needs to in order to test the functionality.
  • Loading branch information
nick-gravgaard committed Jan 15, 2014
1 parent 8cff493 commit 888a6c4
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions tests/read/test_parse_request_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_one_collect_is_parsed_with_custom_method(self):
assert_that(args['collect'], is_([("some_key", "mean")]))

@freeze_time('2014-01-09 00:00:00')
def test_now_and_positive_delta_sets_start_end_window(self):
def test_no_date_means_now(self):
request_args = MultiDict([
('period', 'day'),
('delta', '3'),
Expand All @@ -156,24 +156,6 @@ def test_now_and_positive_delta_sets_start_end_window(self):
assert_that(args['start_at'], is_(
datetime(2014, 1, 9, 0, 0, 0, tzinfo=pytz.UTC)))

assert_that(args['end_at'], is_(
datetime(2014, 1, 12, 0, 0, 0, tzinfo=pytz.UTC)))

@freeze_time('2014-01-09 00:00:00')
def test_now_and_negative_delta_sets_start_end_window(self):
request_args = MultiDict([
('period', 'day'),
('delta', '-3'),
])

args = parse_request_args(request_args)

assert_that(args['start_at'], is_(
datetime(2014, 1, 6, 0, 0, 0, tzinfo=pytz.UTC)))

assert_that(args['end_at'], is_(
datetime(2014, 1, 9, 0, 0, 0, tzinfo=pytz.UTC)))

def test_date_on_boundary_and_positive_delta(self):
request_args = MultiDict([
('date', '2014-01-09T00:00:00+00:00'),
Expand Down

0 comments on commit 888a6c4

Please sign in to comment.