Skip to content

Commit b7c45af

Browse files
Create test_metadata_normaliser.py
1 parent 1f9ca9c commit b7c45af

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from pytest_bdd import scenario, given, when, then, parsers
2+
3+
from ted_sws.core.model.notice import NoticeStatus
4+
from ted_sws.notice_metadata_processor.services.metadata_normalizer import MetadataNormaliser
5+
6+
7+
@scenario('metadata_normaliser.feature', 'Normalizing a notice metadata')
8+
def test_extract_metadata():
9+
"""normalising metadata"""
10+
11+
12+
@given("a notice", target_fixture="notice")
13+
def step_impl(f03_notice_2020):
14+
return f03_notice_2020
15+
16+
17+
@when("the normalize process is executed")
18+
def step_impl(notice):
19+
MetadataNormaliser(notice=notice).normalise_metadata()
20+
21+
22+
@then(parsers.parse("a normalized notice {metadata} is {possibly} available"))
23+
def step_impl(notice, metadata, possibly):
24+
metadata_value = notice.normalised_metadata.dict()[metadata]
25+
is_value_there = "True" if metadata_value else "False"
26+
assert is_value_there == possibly
27+
28+
29+
@then("the notice status is NORMALISED_METADATA")
30+
def step_impl(notice):
31+
assert notice.status is NoticeStatus.NORMALISED_METADATA
32+
33+
34+
@then("normalised metadata is available")
35+
def step_impl(notice):
36+
assert notice.normalised_metadata

0 commit comments

Comments
 (0)