コード例 #1
0
 def test_admin_change_link_target_blank(self):
     """
     Test that admin_change_url() returns an anchor tag with target="_blank" to the change
     page for an object.
     """
     book = BookFactory.build(pk=uuid4())
     assert admin_change_link(book, True) == (
         f'<a href="/admin/support/book/{book.pk}/change/" target="_blank">{book}</a>'
     )
コード例 #2
0
 def test_returns_empty_string_if_no_pk(self):
     """Test that if the object has no pk, an empty link is returned."""
     book = BookFactory.build()
     assert get_change_link(book) == ''
コード例 #3
0
def test_admin_change_url():
    """Test that admin_change_url() returns the URL to the change page for an object."""
    book = BookFactory.build(pk=uuid4())
    assert admin_change_url(book) == f'/admin/support/book/{book.pk}/change/'