Example #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)
Example #2
0
 class Meta:
     authentication = AppAuthentication()
     authorization = MozillaOfficialAuthorization()
     list_allowed_methods = ['get']
     serializer = Serializer(formats=['json', 'jsonp'])
     paginator_class = Paginator
     include_resource_uri = False
     detail_allowed_methods = []
     cache_control = {'max-age': 0}
Example #3
0
 class Meta:
     authentication = AppAuthentication()
     authorization = MozillaOfficialAuthorization()
     cache_control = {'max-age': 0}
     list_allowed_methods = ['get']
     detail_allowed_methods = ['get']
     paginator_class = Paginator
     serializer = Serializer(formats=['json', 'jsonp'])
     fields = ['id', 'name', 'number_of_members']
     ordering = ['id', 'name', 'number_of_members']
     default_order = ['id']
Example #4
0
 class Meta:
     queryset = UserProfile.objects.all()
     authentication = AppAuthentication()
     authorization = MozillaOfficialAuthorization()
     serializer = Serializer(formats=['json', 'jsonp', 'xml'])
     paginator_class = Paginator
     cache_control = {'max-age': 0}
     list_allowed_methods = ['get']
     detail_allowed_methods = ['get']
     resource_name = 'users'
     restrict_fields = False
     restricted_fields = ['email', 'is_vouched']
     fields = []
Example #5
0
 class Meta:
     queryset = UserProfile.objects.all()
     authentication = AppAuthentication()
     authorization = MozillaOfficialAuthorization()
     serializer = Serializer(formats=['json', 'jsonp'])
     paginator_class = Paginator
     cache_control = {'max-age': 0}
     list_allowed_methods = ['get']
     detail_allowed_methods = ['get']
     resource_name = 'users'
     restrict_fields = False
     restricted_fields = ['email', 'is_vouched']
     fields = ['id', 'full_name', 'is_vouched', 'website', 'vouched_by',
               'date_vouched', 'groups', 'skills', 'languages',
               'bio', 'photo', 'ircname', 'country', 'region', 'city',
               'date_mozillian', 'timezone', 'email', 'allows_mozilla_sites',
               'allows_community_sites']
Example #6
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)
Example #7
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)
Example #8
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)
Example #9
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))