def test_non_existing_action(admin_site, article): """Test for appropriate exception, when `action` is not found.""" from test_proj.blog.admin import ArticleAdmin ArticleAdmin.inline_actions = ['non_existing'] fake_request = {} admin = ArticleAdmin(article, admin_site) admin._request = fake_request with pytest.raises(RuntimeError): admin.render_inline_actions(article) # reset ArticleAdmin.inline_actions = []
def test_skip_rendering_actions_for_unsaved_objects(admin_client, mocker, article): from test_proj.blog.admin import ArticleAdmin unsaved_article = Article() admin = ArticleAdmin(unsaved_article, admin_site) assert admin.render_inline_actions(unsaved_article) == ''