def test_image_convert_fromdropbox_missing_path(self): jwt_token = generate_jwt('*****@*****.**', 'dropbox-access-token') headers = {'authorization': f'Bearer {jwt_token}'} response = self.client.post('/image/convert/fromdropbox', headers=headers) self.assertEqual(response.status_code, 400) self.assertIn(b'Missing path parameter', response.data)
def test_image_convert_fromdropbox_invalid_access_token(self): jwt_token = generate_jwt('*****@*****.**', 'dropbox-access-token') headers = {'authorization': f'Bearer {jwt_token}'} payload = {'path': '/test.png', 'format': 'jpeg'} response = self.client.post('/image/convert/fromdropbox', headers=headers, data=payload) self.assertEqual(response.status_code, 401) self.assertIn(b'Invalid Dropbox access token', response.data)
def setUp(self): app.config.from_object('config.TestConfig') self.client = app.test_client() jwt_token = generate_jwt('*****@*****.**') self.headers = {'authorization': f'Bearer {jwt_token}'}
def test_image_convert_fromdropbox_have_access_token(self): jwt_token = generate_jwt('*****@*****.**', 'dropbox-access-token') headers = {'authorization': f'Bearer {jwt_token}'} response = self.client.post('/image/convert/fromdropbox', headers=headers) self.assertNotIn(b'Missing access_token parameter', response.data)