-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds the sites framework to be able to get the full url in the manage…
…ment command
- Loading branch information
1 parent
90d198f
commit ca0d6ef
Showing
5 changed files
with
55 additions
and
24 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
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,34 @@ | ||
from django.conf import settings | ||
from django.contrib.sites.models import Site | ||
from django.core import mail | ||
from django.core.urlresolvers import reverse | ||
from django.test import TestCase | ||
|
||
from model_mommy import mommy | ||
|
||
from meupet.models import Pet | ||
|
||
|
||
class ServicesTest(TestCase): | ||
def test_request_action_from_user(self): | ||
"""Validate the information sent in the email""" | ||
pet = mommy.make(Pet) | ||
pet.request_action() | ||
email = mail.outbox[0] | ||
current_site = Site.objects.get_current() | ||
|
||
pet_update_url = reverse('meupet:update_register', args=[pet.request_key]) | ||
full_url = '%s%s' % (current_site.domain, pet_update_url) | ||
|
||
contents = [ | ||
pet.name, | ||
pet.owner.first_name, | ||
str(settings.DAYS_TO_STALE_REGISTER), | ||
full_url, | ||
pet.get_status_display(), | ||
current_site.name, | ||
] | ||
|
||
for expected in contents: | ||
with self.subTest(): | ||
self.assertIn(expected, email.body) |
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