Ejemplo n.º 1
0
 def test_user_associated_properly(self, mock):
     """Does the user get associated after the upload?"""
     r = self.client.post(self.path, self.data)
     j = json.loads(r.content)
     processing_request = ProcessingQueue.objects.get(pk=j['id'])
     self.assertEqual(self.user.pk, processing_request.uploader_id)
     mock.assert_called()
Ejemplo n.º 2
0
 def test_user_associated_properly(self, mock):
     """Does the user get associated after the upload?"""
     r = self.client.post(self.path, self.data)
     j = json.loads(r.content)
     processing_request = ProcessingQueue.objects.get(pk=j['id'])
     self.assertEqual(self.user.pk, processing_request.uploader_id)
     mock.assert_called()
Ejemplo n.º 3
0
 def test_ensure_no_users_in_response(self, mock):
     """Is all user information excluded from the processing queue?"""
     r = self.client.post(self.path, self.data)
     j = json.loads(r.content)
     for bad_key in ['uploader', 'user']:
         with self.assertRaises(KeyError):
             # noinspection PyStatementEffect
             j[bad_key]
     mock.assert_called()
Ejemplo n.º 4
0
 def test_ensure_no_users_in_response(self, mock):
     """Are users excluded from the response?"""
     r = self.client.post(self.path, self.data)
     j = json.loads(r.content)
     for bad_key in ['uploader', 'user']:
         with self.assertRaises(KeyError):
             # noinspection PyStatementEffect
             j[bad_key]
     mock.assert_called()
Ejemplo n.º 5
0
    def test_uploading_a_pdf(self, mock):
        """Can we upload a document and have it be saved correctly?"""
        r = self.client.post(self.path, self.data)
        self.assertEqual(r.status_code, HTTP_201_CREATED)

        j = json.loads(r.content)
        self.assertEqual(j['court'], 'akd')
        self.assertEqual(j['document_number'], 1)
        self.assertEqual(j['pacer_case_id'], 'asdf')
        mock.assert_called()
Ejemplo n.º 6
0
    def test_uploading_a_pdf(self, mock):
        """Can we upload a document and have it be saved correctly?"""
        r = self.client.post(self.path, self.data)
        self.assertEqual(r.status_code, HTTP_201_CREATED)

        j = json.loads(r.content)
        self.assertEqual(j['court'], 'scotus')
        self.assertEqual(j['document_number'], 'asdf')
        self.assertEqual(j['pacer_case_id'], 'asdf')
        mock.assert_called()
Ejemplo n.º 7
0
 def test_uploading_non_ascii(self, mock):
     """Can we handle it if a client sends non-ascii strings?"""
     self.data['pacer_case_id'] = u'☠☠☠'
     r = self.client.post(self.path, self.data)
     self.assertEqual(r.status_code, HTTP_201_CREATED)
     mock.assert_called()
Ejemplo n.º 8
0
 def test_uploading_non_ascii(self, mock):
     """Can we handle it if a client sends non-ascii strings?"""
     self.data['document_number'] = u'☠☠☠'
     r = self.client.post(self.path, self.data)
     self.assertEqual(r.status_code, HTTP_201_CREATED)
     mock.assert_called()
Ejemplo n.º 9
0
 def test_existe_archivo_temporal(self, mock):
     configurador.existe_archivo_temporal()
     mock.assert_called()