def test_django_cache(self): self.override_django_settings() try: from django.core.cache import cache cache.set('bugzilla-access-cookies', []) bugzilla = get_django_bugzilla() self.assertTrue(bugzilla.cookie_set) finally: self.restore_django_settings()
def test_django_login(self): self.override_django_settings() try: from django.core.cache import cache cache.delete('bugzilla-access-cookies') self.httpretty_login() bugzilla = get_django_bugzilla() self.assertFalse(bugzilla.cookie_set) finally: self.restore_django_settings()
def test_django_relogin(self): self.override_django_settings() try: from django.core.cache import cache cache.set('bugzilla-access-cookies', []) bugzilla = get_django_bugzilla() self.assertTrue(bugzilla.cookie_set) self.httpretty_login() bugzilla.login(force=True) finally: self.restore_django_settings()
def test_django_auto_relogin(self): self.override_django_settings() try: from django.core.cache import cache cache.set("bugzilla-access-cookies", []) bugzilla = get_django_bugzilla() self.assertTrue(bugzilla.cookie_set) httpretty.register_uri(httpretty.POST, "https://apibugzilla.suse.com/show_bug.cgi", status=502) self.httpretty_login() self.assertRaises(WebScraperError, bugzilla.get_bug, 81873) self.assertFalse(bugzilla.cookie_set) finally: self.restore_django_settings()
def test_django_auto_relogin(self): self.override_django_settings() try: from django.core.cache import cache cache.set('bugzilla-access-cookies', []) bugzilla = get_django_bugzilla() self.assertTrue(bugzilla.cookie_set) httpretty.register_uri( httpretty.POST, 'https://apibugzilla.suse.com/show_bug.cgi', status=502, ) self.httpretty_login() self.assertRaises(WebScraperError, bugzilla.get_bug, 81873) self.assertFalse(bugzilla.cookie_set) finally: self.restore_django_settings()