class TestDRFAuthentication(test_utils.TestCase): def setUp(self): self.authentication = RestOAuthAuthentication() self.factory = RequestFactory() self.consumer = Consumer(*keys.items()[0]) def test_skip(self): req = self.factory.get("/skip-oauth/") with self.settings(REQUIRE_OAUTH=True, SKIP_OAUTH=["/skip-oauth/"]): ok_(self.authentication.authenticate(req)) def test_not_skip(self): req = self.factory.get("/require-oauth/") with self.settings(REQUIRE_OAUTH=True, SKIP_OAUTH=["/skip-oauth/"]): eq_(self.authentication.authenticate(req), AuthenticationFailed)
class TestDRFAuthentication(test_utils.TestCase): def setUp(self): self.authentication = RestOAuthAuthentication() self.factory = RequestFactory() self.consumer = Consumer(*keys.items()[0]) def test_skip(self): req = self.factory.get('/skip-oauth/') with self.settings(REQUIRE_OAUTH=True, SKIP_OAUTH=['/skip-oauth/']): ok_(self.authentication.authenticate(req)) def test_not_skip(self): req = self.factory.get('/require-oauth/') with self.settings(REQUIRE_OAUTH=True, SKIP_OAUTH=['/skip-oauth/']): eq_(self.authentication.authenticate(req), AuthenticationFailed)