Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
store today
Browse files Browse the repository at this point in the history
  • Loading branch information
camsom committed Jan 12, 2016
1 parent a274883 commit f7ba2e1
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/special_coverage/test_spec_cov_api.py
Expand Up @@ -259,19 +259,21 @@ def test_special_coverage_ordering_by_campaign_label(self):
def test_special_coverage_search_by_status(self):
"""Test that special coverages can be searched by their status."""

today_in_variable_form_for_mike_parent = today()

# matching
special_coverage = SpecialCoverage.objects.create(
name="some special coverage",
start_date=today() - timezone.timedelta(days=2),
end_date=today() + timezone.timedelta(days=2),
start_date=today_in_variable_form_for_mike_parent - timezone.timedelta(days=2),
end_date=today_in_variable_form_for_mike_parent + timezone.timedelta(days=2),
promoted=False
)

# non-matching
SpecialCoverage.objects.create(
name="Joe Biden",
start_date=today() - timezone.timedelta(days=5),
end_date=today() - timezone.timedelta(days=3),
start_date=today_in_variable_form_for_mike_parent - timezone.timedelta(days=5),
end_date=today_in_variable_form_for_mike_parent - timezone.timedelta(days=3),
promoted=True
)

Expand Down Expand Up @@ -378,16 +380,18 @@ def test_special_coverage_persists_after_campaign_deletion(self):
def test_active_and_promoted_lowercase_boolean(self):
"""Tests that filter backend can correctly evaluate 'true' and 'false'."""

today_in_variable_form_for_mike_parent = today()

special_coverage_1 = SpecialCoverage.objects.create(
name="Promoted",
start_date=today() - timezone.timedelta(days=1),
end_date=today() + timezone.timedelta(days=1),
start_date=today_in_variable_form_for_mike_parent - timezone.timedelta(days=1),
end_date=today_in_variable_form_for_mike_parent + timezone.timedelta(days=1),
promoted=True
)
special_coverage_2 = SpecialCoverage.objects.create(
name="Not active or promoted",
start_date=today() + timezone.timedelta(days=1),
end_date=today() + timezone.timedelta(days=2),
start_date=today_in_variable_form_for_mike_parent + timezone.timedelta(days=1),
end_date=today_in_variable_form_for_mike_parent + timezone.timedelta(days=2),
promoted=False
)

Expand Down

0 comments on commit f7ba2e1

Please sign in to comment.