From 0e520ac4fc97025cd95e4dcbf82894721969e967 Mon Sep 17 00:00:00 2001 From: Roy Willy Haug Date: Fri, 8 Dec 2023 10:14:30 +0100 Subject: [PATCH] Try fixtures for explorer --- .../run_tests_uploads_from_komodo.yaml | 2 +- tests/test_uploads_from_komodo.py | 51 ++++++++++++------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/.github/workflows/run_tests_uploads_from_komodo.yaml b/.github/workflows/run_tests_uploads_from_komodo.yaml index f2d96b4..3c7588a 100644 --- a/.github/workflows/run_tests_uploads_from_komodo.yaml +++ b/.github/workflows/run_tests_uploads_from_komodo.yaml @@ -1,4 +1,4 @@ -name: Build and test fmu-sumo-uploader +name: Build and test case previously uploaded from komodoe-releases on: pull_request: diff --git a/tests/test_uploads_from_komodo.py b/tests/test_uploads_from_komodo.py index cb17d85..49eb9ae 100644 --- a/tests/test_uploads_from_komodo.py +++ b/tests/test_uploads_from_komodo.py @@ -41,9 +41,9 @@ # return self._connection -def _get_latest_case(): +def _get_latest_case(explorer): """Returns latest f_scout_ci case that was uploaded from komodo-releases""" - cases = sumo.cases + cases = explorer.cases cases = cases.filter(user="f_scout_ci") assert (len(cases) > 0) newest_date = "1000-01-01T00:00:00.000Z" @@ -58,33 +58,48 @@ def _get_latest_case(): return newest_case -sumo = Explorer(env=ENV) -case = _get_latest_case() +# sumo = Explorer(env=ENV) +# case = _get_latest_case() + +@pytest.fixture(name="explorer") +def fixture_explorer(token: str) -> Explorer: + """Returns explorer""" + return Explorer("dev", token=token) ### TESTS ### -def test_case_exists(): - assert(case) -def test_case_have_enough_children_in_total(): - # We know that komodo-releases uploads 111 child objects in total + +def test_case(explorer: Explorer): + case = _get_latest_case(explorer) + assert(case) number_of_children = len(case.cubes) + len(case.polygons) + len(case.surfaces) + len(case.dictionaries) + len(case.tables) assert(number_of_children > 110) - -def test_case_have_enough_surfaces(): assert(len(case.surfaces) > 53) - -def test_case_have_enough_cubes(): assert(len(case.cubes) > 9) - -def test_case_have_enough_tables(): assert(len(case.tables) > 6) - -def test_case_have_enough_polygons(): assert(len(case.polygons) > 5) - -def test_case_have_enough_dictionaries(): assert(len(case.dictionaries) > 0) +# def test_case_have_enough_children_in_total(): +# # We know that komodo-releases uploads 111 child objects in total +# number_of_children = len(case.cubes) + len(case.polygons) + len(case.surfaces) + len(case.dictionaries) + len(case.tables) +# assert(number_of_children > 110) + +# def test_case_have_enough_surfaces(): +# assert(len(case.surfaces) > 53) + +# def test_case_have_enough_cubes(): +# assert(len(case.cubes) > 9) + +# def test_case_have_enough_tables(): +# assert(len(case.tables) > 6) + +# def test_case_have_enough_polygons(): +# assert(len(case.polygons) > 5) + +# def test_case_have_enough_dictionaries(): +# assert(len(case.dictionaries) > 0) +