only write the test if it doesn't exist yet

This commit is contained in:
hjoaquim
2023-09-25 17:03:23 +01:00
parent 1bfd131fad
commit 148771cbf2

View File

@@ -65,6 +65,11 @@ def test_{route.replace("/", "_")[1:]}(params, headers):
f.write(template)
def test_exists(route: str, path: str):
with open(path, "r") as f:
return route.replace("/", "_")[1:] in f.read()
def write_integration_tests(
command_map: CommandMap,
provider_interface: ProviderInterface,
@@ -102,8 +107,8 @@ def write_integration_tests(
)
)
# TODO : only writes the test if it doesn't exist yet
write_test_w_template(params_list=params_list, route=route, path=path)
if not test_exists(route=route, path=path):
write_test_w_template(params_list=params_list, route=route, path=path)
return commands_not_found