liminspace / django-mjml

The simplest way to use MJML in Django templates.
MIT License
262 stars 32 forks source link

Mock httpserver #134

Closed aabanaag closed 3 years ago

aabanaag commented 3 years ago

I added the httpserver config, but running my test fails because of the RuntimeError: MJML compile error (via MJML HTTP server):

Is there a way to mock the MJML calls? I'm doing a mock on the actual email sending

with patch("requests.post") as mock_post:
     mock_post.return_value(ok=True, status=status.HTTP_201_CREATED)
liminspace commented 3 years ago

@aabanaag try to mock MJMLRenderNode.render or mjml_render or _mjml_render_by_httpserver

aabanaag commented 3 years ago

Thank you, I got it by mocking _mjml_render_by_httpserver