Ejemplo n.º 1
0
    def test_reference_api(self):
        self._seed_data()
        reference_req = ReferenceRequest(1, 'Mr', 'John', 'Snow', 'Supervisor',
                                         '*****@*****.**')
        reference_request_repository.create(reference_req)
        REFERENCE_DETAIL = {
            'token': reference_req.token,
            'uploaded_document': 'DOCT-UPLOAD-78999',
        }
        response = self.app.post('/api/v1/reference',
                                 data=REFERENCE_DETAIL,
                                 headers=self.first_headers)
        self.assertEqual(response.status_code, 201)

        response = self.app.get('/api/v1/reference',
                                data={'response_id': 1},
                                headers=self.first_headers)
        LOGGER.debug(response.data)
        data = json.loads(response.data)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(data), 1)
        reference_request = reference_request_repository.get_by_id(1)
        self.assertEqual(reference_request.has_reference, True)
Ejemplo n.º 2
0
 def get(self):
     args = self.get_req_parser.parse_args()
     return reference_request_repository.get_by_id(args['id']), 200
Ejemplo n.º 3
0
 def get(self):
     LOGGER.debug('Received get request for reference-request')
     args = self.get_req_parser.parse_args()
     return reference_request_repository.get_by_id(args['id']), 200