-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
113 additions
and
46 deletions.
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
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,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.10.5 on 2017-05-16 14:05 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounts', '0006_profile_current_team'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='profile', | ||
name='reports_allowed', | ||
field=models.IntegerField(default=0), | ||
), | ||
] |
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
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 |
---|---|---|
@@ -1,24 +1,37 @@ | ||
from hc.test import BaseTestCase | ||
from hc.accounts.models import MONTHLY_REPORTS, WEEKLY_REPORTS, DAILY_REPORTS | ||
|
||
|
||
class NotificationsTestCase(BaseTestCase): | ||
|
||
def test_it_saves_reports_allowed_true(self): | ||
def test_it_saves_reports_allowed_monthly(self): | ||
self.client.login(username="alice@example.org", password="password") | ||
|
||
form = {"reports_allowed": "on"} | ||
form = {"reports_allowed": 1} | ||
r = self.client.post("/accounts/profile/notifications/", form) | ||
assert r.status_code == 200 | ||
|
||
self.alice.profile.refresh_from_db() | ||
self.assertTrue(self.alice.profile.reports_allowed) | ||
self.assertEqual(self.alice.profile.reports_allowed, MONTHLY_REPORTS) | ||
|
||
def test_it_saves_reports_allowed_false(self): | ||
def test_it_saves_reports_allowed_weekly(self): | ||
self.client.login(username="alice@example.org", password="password") | ||
|
||
form = {} | ||
form = {"reports_allowed": 2} | ||
# import ipdb; ipdb.set_trace() | ||
r = self.client.post("/accounts/profile/notifications/", form) | ||
assert r.status_code == 200 | ||
|
||
self.alice.profile.refresh_from_db() | ||
self.assertFalse(self.alice.profile.reports_allowed) | ||
self.assertEqual(self.alice.profile.reports_allowed, WEEKLY_REPORTS) | ||
|
||
def test_it_saves_reports_allowed_daily(self): | ||
self.client.login(username="alice@example.org", password="password") | ||
|
||
form = {"reports_allowed": 3} | ||
r = self.client.post("/accounts/profile/notifications/", form) | ||
assert r.status_code == 200 | ||
|
||
self.alice.profile.refresh_from_db() | ||
self.assertEqual(self.alice.profile.reports_allowed, DAILY_REPORTS) | ||
|
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Monthly Report | ||
{{ report_date }} Report | ||
|