Skip to content

Commit

Permalink
added test to check xml generator error raise
Browse files Browse the repository at this point in the history
  • Loading branch information
JJFlorian committed Mar 15, 2024
1 parent 7e34c67 commit 7203902
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion api/tests/test_bro_upload.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

from api.bro_upload import delivery

expected_xml_str = """<registrationRequest xmlns="http://www.broservices.nl/xsd/isgmn/1.0"
Expand Down Expand Up @@ -45,7 +47,7 @@
"""


def test_xml_generator():
def test_xml_generator1():
generator = delivery.XMLGenerator(
registration_type="GMN_StartRegistration",
request_type="registration",
Expand Down Expand Up @@ -77,3 +79,14 @@ def test_xml_generator():
)

assert generator.create_xml_file() == expected_xml_str

def test_xml_generator2():
"""Tests a non existing combination of registration_type and request type."""
with pytest.raises(delivery.XMLGenerationError):
generator = delivery.XMLGenerator(
registration_type="GMN_StartRegistration",
request_type="insert",
metadata={},
sourcedocs_data={},
)
generator.create_xml_file()

0 comments on commit 7203902

Please sign in to comment.