This repository has been archived by the owner on Oct 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #701 from akatsoulas/970749
[fix bug 970749] Raise 404 error in month2number method if the input is ...
- Loading branch information
Showing
2 changed files
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from datetime import datetime | ||
|
||
import mock | ||
from nose.tools import eq_ | ||
|
||
from remo.base.tests import RemoTestCase | ||
from remo.base.utils import month2number | ||
from remo.profiles.tests import UserFactory | ||
from remo.reports.tests import NGReportFactory | ||
|
||
|
||
class TestBaseUtils(RemoTestCase): | ||
"""Tests for the utilities in base app.""" | ||
|
||
@mock.patch('remo.base.utils.month2number', wraps=month2number) | ||
def test_month2number(self, mocked_month2number): | ||
user = UserFactory.create(groups='Rep') | ||
report_date = datetime(year=2014, month=4, day=1).date() | ||
NGReportFactory.create(user=user, report_date=report_date) | ||
reports_url = ('/reports/rep/' + user.userprofile.display_name + | ||
'/?year=2014&month=Apri') | ||
response = self.client.get(reports_url, follow=True) | ||
mocked_month2number.assert_called_once_with(u'Apri') | ||
eq_(response.status_code, 404) | ||
self.assertTemplateUsed(response, '404.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters