Example #1
0
 def test_missing_params(self):
     """ Tests that missing params return a bad request status """
     request = self.factory.get('/s3/signatures/', format='json')
     request.user = self.user
     force_authenticate(request, user=self.user)
     response = views.s3signatures(request)
     assert response.status_code == 400, 'missing s3_object_name should cause http status 400, not %d' % (response.status_code)
Example #2
0
 def test_not_authorized(self):
     """ Tests that an unauthenticed request fails """
     request = self.factory.get('/s3/signatures/?s3_object_name=1',
                                format='json')
     response = views.s3signatures(request)
     assert response.status_code == 401, 'unauthorized attempt should cause http status 401, not %d' % (
         response.status_code)
Example #3
0
 def test_success(self):
     request = self.factory.get('/s3/signatures/?s3_object_name=1',
                                format='json')
     request.user = self.user
     force_authenticate(request, user=self.user)
     response = views.s3signatures(request)
     assert response.status_code == 200, 'successful message should return http status 200, not %d' % (
         response.status_code)
Example #4
0
 def test_missing_params(self):
     """ Tests that missing params return a bad request status """
     request = self.factory.get('/s3/signatures/', format='json')
     request.user = self.user
     force_authenticate(request, user=self.user)
     response = views.s3signatures(request)
     assert response.status_code == 400, 'missing s3_object_name should cause http status 400, not %d' % (
         response.status_code)
Example #5
0
 def test_success(self):
     request = self.factory.get('/s3/signatures/?s3_object_name=1', format='json')
     request.user = self.user
     force_authenticate(request, user=self.user)
     response = views.s3signatures(request)
     assert response.status_code == 200, 'successful message should return http status 200, not %d' % (response.status_code)
Example #6
0
 def test_not_authorized(self):
     """ Tests that an unauthenticed request fails """
     request = self.factory.get('/s3/signatures/?s3_object_name=1', format='json')
     response = views.s3signatures(request)
     assert response.status_code == 401, 'unauthorized attempt should cause http status 401, not %d' % (response.status_code)