Ejemplo n.º 1
0
 def test_community_app(self):
     app = APIAppFactory.create(is_mozilla_app=False)
     request = RequestFactory()
     request.GET = {'app_key': app.key, 'app_name': app.name}
     authentication = AppAuthentication()
     authentication.is_authenticated(request)
     eq_(request.GET.get('restricted'), True)
Ejemplo n.º 2
0
 def test_invalid_app_name_and_key(self):
     request = RequestFactory()
     request.GET = {'app_key': 'invalid', 'app_name': 'invalid'}
     authentication = AppAuthentication()
     eq_(authentication.is_authenticated(request), False)
Ejemplo n.º 3
0
 def test_empty_app_name(self):
     app = APIAppFactory.create()
     request = RequestFactory()
     request.GET = {'app_key': app.key}
     authentication = AppAuthentication()
     eq_(authentication.is_authenticated(request), False)
Ejemplo n.º 4
0
 def test_invalid_app_key(self):
     app = APIAppFactory.create()
     request = RequestFactory()
     request.GET = {'app_key': 'invalid', 'app_name': app.name}
     authentication = AppAuthentication()
     eq_(authentication.is_authenticated(request), False)
Ejemplo n.º 5
0
 def test_valid_app(self):
     app = APIAppFactory.create()
     request = RequestFactory()
     request.GET = {'app_key': app.key, 'app_name': app.name}
     authentication = AppAuthentication()
     ok_(authentication.is_authenticated(request))