Fixed #26446 -- Added additional tests to cover methods in the RequestSite class

This commit is contained in:
Piers Storey 2016-04-03 10:45:23 +02:00 committed by Markus Holtermann
parent c08ad63a33
commit 319b7112d8
1 changed files with 20 additions and 0 deletions

View File

@ -190,6 +190,26 @@ class SitesFrameworkTests(TestCase):
self.assertEqual(Site.objects.get_by_natural_key(self.site.domain), self.site)
self.assertEqual(self.site.natural_key(), (self.site.domain,))
def test_requestsite_save_notimplemented_msg(self):
# Test response msg for RequestSite.save NotImplementedError
request = HttpRequest()
request.META = {
"HTTP_HOST": "example.com",
}
msg = 'RequestSite cannot be saved.'
with self.assertRaisesMessage(NotImplementedError, msg):
RequestSite(request).save()
def test_requestsite_delete_notimplemented_msg(self):
# Test response msg for RequestSite.delete NotImplementedError
request = HttpRequest()
request.META = {
"HTTP_HOST": "example.com",
}
msg = 'RequestSite cannot be deleted.'
with self.assertRaisesMessage(NotImplementedError, msg):
RequestSite(request).delete()
class JustOtherRouter(object):
def allow_migrate(self, db, app_label, **hints):