0

I have an app with this unit test file:

from webtest import TestApp

import unittest

from app import app


class UploadUnitTest(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.app = TestApp(app)

    def test_file_not_exists(self):
        response = self.app.post('/api/upload/')
        self.assertEqual(response.status_code, 200)


if __name__ == '__main__':
    unittest.main()

How can I send a sample file to test upload endpoint?

Kevin Martins
  • 590
  • 7
  • 20
user907988
  • 625
  • 1
  • 5
  • 17
  • 2
    This test looks weird to me. It sounds like BDD test instead... Are you sure you do not want to test the code which handle the upload process? I – felipsmartins Mar 04 '20 at 00:18
  • Does this answer your question? [Testing file uploads in Flask](https://stackoverflow.com/questions/35684436/testing-file-uploads-in-flask) – felipsmartins Mar 04 '20 at 00:20

0 Answers0