add follow redirect and delete first database init release

This commit is contained in:
vincent 2021-06-13 21:02:13 +02:00
parent d89c2591c5
commit 34201b928d

View File

@ -12,8 +12,6 @@ class TestBase(unittest.TestCase):
self.config = DefaultConfig() self.config = DefaultConfig()
self.config.BASE["database_uri"] = "sqlite:///" + self.__db[1] self.config.BASE["database_uri"] = "sqlite:///" + self.__db[1]
self.config.TESTING = True self.config.TESTING = True
init_database(self.config.BASE["database_uri"])
release_database()
self.__app = create_app(self.config) self.__app = create_app(self.config)
self.client = self.__app.test_client() self.client = self.__app.test_client()
@ -34,8 +32,8 @@ class APITestBase(TestBase):
if not isinstance(args, dict): if not isinstance(args, dict):
raise TypeError("'args', expecting a dict, got " + type(args).__name__) raise TypeError("'args', expecting a dict, got " + type(args).__name__)
uri = "/api/v1/{}".format(endpoint) uri = "/api/v1/{}".format(endpoint)
method = getattr(self.client, method) method = getattr(self.client, method)
rv = method(uri, data=args) rv = method(uri, data=args, follow_redirects=True)
print(rv.data)
self.assertEqual(rv.status_code, return_code) self.assertEqual(rv.status_code, return_code)
return rv return rv