fix unit tests

This commit is contained in:
jbannon 2022-04-05 00:28:52 +00:00
parent 922ac3b7cf
commit 836e186ab1
2 changed files with 5 additions and 5 deletions

View file

@ -65,7 +65,7 @@ class TestEntry(object):
def test_entry_formatter_fails_missing_field(self, mock_entry):
format_string = f"prefix {{bah_humbug}} suffix"
available_fields = ", ".join(sorted(mock_entry.to_dict()._keys()))
available_fields = ", ".join(sorted(mock_entry.to_dict().keys()))
expected_error_msg = f"Format variable 'bah_humbug' does not exist for Entry. Available fields: {available_fields}"
with pytest.raises(ValueError, match=expected_error_msg):

View file

@ -20,14 +20,14 @@ class TestEntryFormatter(object):
def test_parse(self):
format_string = "Here is my {var_one} and {var_two} 💩"
assert StringFormatterValidator(
name="test_format_variables", format_string=format_string
name="test_format_variables", value=format_string
).format_variables == ["var_one", "var_two"]
def test_parse_no_variables(self):
format_string = "No vars 💩"
assert (
StringFormatterValidator(
name="test_format_variables_empty", format_string=format_string
name="test_format_variables_empty", value=format_string
).format_variables
== []
)
@ -49,7 +49,7 @@ class TestEntryFormatter(object):
)
with pytest.raises(ValidationException, match=expected_error_msg):
_ = StringFormatterValidator(name="fail", format_string=format_string)
_ = StringFormatterValidator(name="fail", value=format_string)
@pytest.mark.parametrize(
"format_string",
@ -70,4 +70,4 @@ class TestEntryFormatter(object):
)
with pytest.raises(ValidationException, match=expected_error_msg):
_ = StringFormatterValidator(name="fail", format_string=format_string)
_ = StringFormatterValidator(name="fail", value=format_string)