check if key exists before creating key and rename functions

This commit is contained in:
2023-11-24 17:45:15 +00:00
parent eb782d879c
commit 21abfa5eda
5 changed files with 28 additions and 33 deletions

View File

@@ -109,13 +109,13 @@ class TestPostEtherpad:
def test_agenda_id(self, post_saved, mock_createpad):
mock_createpad.return_value = post_saved.slug + "-agenda"
k = post_saved.get_agenda_key()
k = post_saved.create_agenda_key()
mock_createpad.assert_called_with(post_saved.slug + "-agenda")
assert post_saved.slug in str(k)
def test_protocol_id(self, post_saved, mock_createpad):
mock_createpad.return_value = post_saved.slug + "-protocol"
k = post_saved.get_protocol_key()
k = post_saved.create_protocol_key()
mock_createpad.assert_called_with(post_saved.slug + "-protocol")
assert post_saved.slug in str(k)
@@ -124,7 +124,7 @@ class TestPostEtherpad:
raise URLError("Mocked Etherpad Down")
mock_createpad.side_effect = raise_url_error
k = post_saved.get_protocol_key()
k = post_saved.create_protocol_key()
mock_createpad.assert_called()
assert k == None