Skip to content

Commit

Permalink
add conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
ElijahAhianyo committed Aug 7, 2023
1 parent 4e1fb83 commit ecb2283
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 28 deletions.
31 changes: 31 additions & 0 deletions tools/ok_validator/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import pytest
from tools.ok_validator.src.validate import OKValidator


@pytest.fixture
def okh_string():
return """
title: mock okh title.
description: mock description for okh.
bom: mock bom field.
"""


@pytest.fixture
def okh_yaml_file(tmp_path, okh_string):
okh_file = tmp_path / "okh.yaml"
okh_file.touch()
okh_file.write_text(okh_string)

return okh_file


@pytest.fixture
def okh_dict():
return {"title": "mock okh title.", "description": "mock description for okh.", "bom": "mock bom field."}


@pytest.fixture
def ok_validator():
return OKValidator(["bom", "title"])

28 changes: 0 additions & 28 deletions tools/ok_validator/tests/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,6 @@
from tools.ok_validator.src.validate import OKValidator, Error


@pytest.fixture
def okh_string():
return """
title: mock okh title.
description: mock description for okh.
bom: mock bom field.
"""


@pytest.fixture
def okh_yaml_file(tmp_path, okh_string):
okh_file = tmp_path / "okh.yaml"
okh_file.touch()
okh_file.write_text(okh_string)

return okh_file


@pytest.fixture
def okh_dict():
return {"title": "mock okh title.", "description": "mock description for okh.", "bom": "mock bom field."}


@pytest.fixture
def ok_validator():
return OKValidator(["bom", "title"])


@pytest.mark.parametrize(
"fixture", ["okh_yaml_file", "okh_dict"]
)
Expand Down

0 comments on commit ecb2283

Please sign in to comment.