Skip to content

Commit

Permalink
Try fixtures for explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
roywilly committed Dec 8, 2023
1 parent 5cf7d3e commit 0e520ac
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_tests_uploads_from_komodo.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and test fmu-sumo-uploader
name: Build and test case previously uploaded from komodoe-releases

on:
pull_request:
Expand Down
51 changes: 33 additions & 18 deletions tests/test_uploads_from_komodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)


0 comments on commit 0e520ac

Please sign in to comment.