diff --git a/README.md b/README.md index 5fd87e4a..ba28640d 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,11 @@ Once installed, `poetry install` installs dependencies into a local virtual envi If you followed the instructions for `CKAN load testing` and `Harvester testing` you can simply run `poetry run pytest` to run all tests. +### Integration testing +- to run integration tests locally add the following env variables to your .env file in addition to their appropriate values + - CF_SERVICE_USER = "put username here" + - CF_SERVICE_AUTH = "put password here" + ## Comparison - `./tests/harvest_sources/ckan_datasets_resp.json` diff --git a/pyproject.toml b/pyproject.toml index 79b69b17..5e7b6d29 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "datagov-harvesting-logic" -version = "0.3.6" +version = "0.3.7" description = "" # authors = [ # {name = "Jin Sun", email = "jin.sun@gsa.gov"}, diff --git a/tests/integration/cf/test_cf_tasks_int.py b/tests/integration/cf/test_cf_tasks_int.py index 10bd437e..27670c42 100644 --- a/tests/integration/cf/test_cf_tasks_int.py +++ b/tests/integration/cf/test_cf_tasks_int.py @@ -1,28 +1,25 @@ -class TestCFTasking: - def test_add_task(self, cf_handler, dhl_cf_task_data): +from time import sleep + - assert cf_handler.start_task(**dhl_cf_task_data) is not None +class TestCFTasking: + def test_crud_task(self, cf_handler, dhl_cf_task_data): - def test_get_task(self, cf_handler, dhl_cf_task_data): + # start a new task + new_task = cf_handler.start_task(**dhl_cf_task_data) + sleep(2) + # retrieve that task via task guid + task = cf_handler.get_task(new_task["guid"]) - task = cf_handler.get_task( - dhl_cf_task_data["app_guuid"], dhl_cf_task_data["task_id"] + # read the recent logs of the task + logs = cf_handler.read_recent_app_logs( + dhl_cf_task_data["app_guuid"], task["guid"] ) - assert task is not None + assert logs is not None + + # cancel the task + cancelled_task = cf_handler.stop_task(task["guid"]) + assert cancelled_task is not None def test_get_all_app_tasks(self, cf_handler, dhl_cf_task_data): tasks = cf_handler.get_all_app_tasks(dhl_cf_task_data["app_guuid"]) assert tasks is not None - - def test_cancel_task(self, cf_handler, dhl_cf_task_data): - - task = cf_handler.stop_task(dhl_cf_task_data["task_id"]) - assert task is not None - - def test_read_recent_task_logs(self, cf_handler, dhl_cf_task_data): - - logs = cf_handler.read_recent_app_logs( - dhl_cf_task_data["app_guuid"], dhl_cf_task_data["task_id"] - ) - - assert logs is not None