Skip to content

Commit b0cecb6

Browse files
Create test_creating_notice.py
1 parent f242aff commit b0cecb6

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from pytest_bdd import scenario, given, when, then
2+
3+
from ted_sws.core.model.manifestation import XMLManifestation
4+
from ted_sws.core.model.metadata import TEDMetadata
5+
from ted_sws.core.model.notice import Notice
6+
7+
8+
@scenario("test_creating_notice.feature", "Create a bare minimum notice")
9+
def test_create_a_bare_minimum_notice():
10+
pass
11+
12+
13+
@given("a TED identifier ted_identifier", target_fixture="ted_identifier")
14+
def step_impl():
15+
return "ted_identifier_1234"
16+
17+
18+
@given("original TED notice metadata notice_metadata", target_fixture="ted_metadata")
19+
def step_impl():
20+
return TEDMetadata(**{"AA": "clever value"})
21+
22+
23+
@given("the XML content of the notice xml_content", target_fixture="notice_content")
24+
def step_impl():
25+
return XMLManifestation(object_data="XML content")
26+
27+
28+
@when("a notice is instantiated", target_fixture="new_notice")
29+
def step_impl(ted_identifier, ted_metadata, notice_content):
30+
return Notice(ted_id=ted_identifier, original_metadata=ted_metadata,
31+
xml_manifestation=notice_content)
32+
33+
34+
@then("a new notice object is available")
35+
def step_impl(new_notice):
36+
assert new_notice is not None
37+
38+
39+
@then("notice_metadata, xml_content, source_url and status RAW are accessible")
40+
def step_impl(new_notice, ted_identifier, ted_metadata, notice_content):
41+
assert new_notice.original_metadata == ted_metadata
42+
assert new_notice.xml_manifestation == notice_content
43+
assert new_notice.ted_id == ted_identifier
44+

0 commit comments

Comments
 (0)