Created
February 14, 2020 05:28
-
-
Save jarshwah/09b03a4eec768ef82bcc3ebb9e4dfa05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pytest_configure(config): | |
config.addinivalue_line( | |
"markers", "enable_inline_css: run css postprocessing over generated emails" | |
) | |
@pytest.fixture(autouse=True) | |
def disable_inline_css(request, monkeypatch): | |
if "enable_inline_css" in request.keywords: | |
return | |
monkeypatch.setattr("email_templates.models.inline_css", identity) | |
@pytest.fixture(autouse=True) | |
def enable_db_access_for_all_tests(db): | |
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
import pytest | |
class EmailTests(unittest.TestCase): | |
# disable the global mock! | |
@pytest.mark.enable_inline_css | |
def test_some_email_css(self): | |
self.assertIn("<div style='...'>email</div>", generate_email()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment