Fix tests by using lower case model name
This commit is contained in:
parent
74ad4a2511
commit
adcbf8bd2e
2 changed files with 22 additions and 23 deletions
|
@ -23,32 +23,32 @@ class TestSnippetLinkHandler:
|
|||
Test snippet template renders correctly
|
||||
"""
|
||||
|
||||
attrs = {"id": 1, "data-app-name": "testapp", "data-model-name": "Advert"}
|
||||
attrs = {"id": 1, "data-app-name": "testapp", "data-model-name": "advert"}
|
||||
result = SnippetLinkHandler.expand_db_attributes(attrs)
|
||||
assert result == f'<a href="{advert.url}/{advert.id}">'
|
||||
|
||||
|
||||
# class TestSnippetEmbedHandler:
|
||||
# @pytest.mark.django_db
|
||||
# def test_advert_setup_correctly(self, advert):
|
||||
# assert advert.text == "advert"
|
||||
# assert advert.url == "https://www.example.com"
|
||||
class TestSnippetEmbedHandler:
|
||||
@pytest.mark.django_db
|
||||
def test_advert_setup_correctly(self, advert):
|
||||
assert advert.text == "advert"
|
||||
assert advert.url == "https://www.example.com"
|
||||
|
||||
# @pytest.mark.django_db
|
||||
# def test_snippet_create_empty_block_on_error(self, advert):
|
||||
# """
|
||||
# Empty block created in case of exception
|
||||
# """
|
||||
@pytest.mark.django_db
|
||||
def test_snippet_create_empty_block_on_error(self, advert):
|
||||
"""
|
||||
Empty block created in case of exception
|
||||
"""
|
||||
|
||||
# result = SnippetEmbedHandler.expand_db_attributes({"id": 0})
|
||||
# assert result == ""
|
||||
result = SnippetEmbedHandler.expand_db_attributes({"id": 0})
|
||||
assert result == ""
|
||||
|
||||
# @pytest.mark.django_db
|
||||
# def test_snippet_embed_handler_renders(self, advert):
|
||||
# """
|
||||
# Test snippet template renders correctly
|
||||
# """
|
||||
@pytest.mark.django_db
|
||||
def test_snippet_embed_handler_renders(self, advert):
|
||||
"""
|
||||
Test snippet template renders correctly
|
||||
"""
|
||||
|
||||
# attrs = {"id": 1, "data-app-name": "testapp", "data-model-name": "Advert"}
|
||||
# result = SnippetEmbedHandler.expand_db_attributes(attrs)
|
||||
# assert result == f'<div>{advert.text}</div>'
|
||||
attrs = {"id": 1, "data-app-name": "testapp", "data-model-name": "advert"}
|
||||
result = SnippetEmbedHandler.expand_db_attributes(attrs)
|
||||
assert result == f'<div>{advert.text}</div>'
|
||||
|
|
|
@ -32,8 +32,7 @@ class SnippetLinkHandler(LinkHandler):
|
|||
snippet_obj = cls.get_instance(attrs)
|
||||
template = cls.get_template(attrs)
|
||||
return render_to_string(template, {"object": snippet_obj})
|
||||
except Exception as e:
|
||||
raise e
|
||||
except Exception:
|
||||
return "<a>"
|
||||
|
||||
|
||||
|
|
Reference in a new issue