Skip to content

Commit

Permalink
unit tests for check_next_url
Browse files Browse the repository at this point in the history
  • Loading branch information
llazzaro committed Sep 27, 2016
1 parent bc62d41 commit 4d45a0c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from schedule.models.rules import Rule

from schedule.views import coerce_date_dict
from schedule.views import check_next_url

from schedule.settings import USE_FULLCALENDAR

Expand Down Expand Up @@ -278,3 +279,15 @@ def test_cal_slug_filters_returned_events(self):
resp_list = json.loads(response.content.decode('utf-8'))
self.assertIn(event1.title, [d['title'] for d in resp_list])
self.assertNotIn(event2.title, [d['title'] for d in resp_list])

def test_check_next_url_valid_case(self):
expected = '/calendar/1'
res = check_next_url('/calendar/1')
self.assertEquals(expected, res)

def test_check_next_url_invalid_case(self):
expected = None
res = check_next_url('http://localhost/calendar/1')
self.assertEquals(expected, res)
res = check_next_url(None)
self.assertEquals(expected, res)

0 comments on commit 4d45a0c

Please sign in to comment.