[python] Some cleanup of samples folder (#17127)

* Delete sample folders of discontinued clients

* Remove duplicate python-flask server sample

The python-flask sample actually lives in samples/server/petstore/python-flask.

* Move hand-written test to "tests" folder

Now, "test" only contains generated stubs and all hand-written tests are in "tests".

* Delete left-over files in Python samples

These are not created by the generators (anymore) and not hand-written
for testing.

* Regenerate test file to fix import error
This commit is contained in:
Robert Schweizer
2023-11-19 07:43:34 +01:00
committed by GitHub
parent 1da970b3b1
commit 75ff110449
71 changed files with 47 additions and 5403 deletions

View File

@@ -19,7 +19,7 @@ class TestConfiguration(unittest.TestCase):
"""Animal unit test stubs"""
def setUp(self):
pass
self.config = petstore_api.Configuration()
def tearDown(self):
# reset Configuration
@@ -58,5 +58,23 @@ class TestConfiguration(unittest.TestCase):
c1 = petstore_api.Configuration(access_token="12345")
self.assertEqual(c1.access_token, "12345")
def test_get_host_settings(self):
host_settings = self.config.get_host_settings()
self.assertEqual('http://{server}.swagger.io:{port}/v2', host_settings[0]['url'])
self.assertEqual('petstore', host_settings[0]['variables']['server']['default_value'])
self.assertEqual('https://localhost:8080/{version}', host_settings[1]['url'])
self.assertEqual('v2', host_settings[1]['variables']['version']['default_value'])
def test_get_host_from_settings(self):
""" Test get_host_from_settings
Test get URL from host settings
"""
self.assertEqual("http://petstore.swagger.io:80/v2", self.config.get_host_from_settings(0))
self.assertEqual("http://petstore.swagger.io:8080/v2", self.config.get_host_from_settings(0, {'port': '8080'}))
self.assertEqual("http://dev-petstore.swagger.io:8080/v2", self.config.get_host_from_settings(0, {'server': 'dev-petstore', 'port': '8080'}))
if __name__ == '__main__':
unittest.main()