Fixed #26446 -- Added additional tests to cover methods in the RequestSite class
This commit is contained in:
parent
c08ad63a33
commit
319b7112d8
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue