-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #978 from SundayMba/bugfix/squeeze_fix
fix: added email service to squeeze sign up
- Loading branch information
Showing
5 changed files
with
101 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block title %}Welcome{% endblock %} | ||
|
||
{% block content %} | ||
<table role="presentation" width="100%" style="padding: 3.5rem;"> | ||
<tr> | ||
<td> | ||
<div style="text-align: center; margin-bottom: 1.5rem;"> | ||
<h1 style="font-size: 1.5rem; color: #0A0A0A; font-weight: 600;">Welcome to Boilerplate Squeeze</h1> | ||
<p style="font-size: 1.125rem; color: rgba(0, 0, 0, 0.8); font-weight: 500;">Thanks for signing up</p> | ||
</div> | ||
|
||
<div> | ||
<p style="color: #111; font-size: 1.125rem; font-weight: 600;">Hi {{name}}</p> | ||
<p style="color: rgba(17, 17, 17, 0.9); font-weight: 400;">Experience quality and innovation | ||
like never before. Our product is made to fit your needs and make your | ||
life easier.</p> | ||
</div> | ||
|
||
<div style="margin-bottom: 1.75rem;"> | ||
<h3 style="color: #0A0A0A; font-weight: 600;">Here's what you can look forward to.</h3> | ||
<div style="margin-bottom: 1.25rem;"> | ||
<ul> | ||
<li> | ||
<span style="font-weight: 600;">Exclusive Offers:</span> Enjoy special promotions and | ||
discounts available only to our members. | ||
</li> | ||
<li> | ||
<span style="font-weight: 600;">Exclusive Offers:</span> Enjoy special promotions and | ||
discounts available only to our members. | ||
</li> | ||
<li> | ||
<span style="font-weight: 600;">Exclusive Offers:</span> Enjoy special promotions and | ||
discounts available only to our members. | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<a href="{{cta_link}}" style="display: block; width: fit-content; padding: 0.5rem 2.5rem; background-color: #F97316; color: white; text-decoration: none; border-radius: 0.5rem; margin: 0 auto; text-align: center;"> | ||
Learn more about us | ||
</a> | ||
|
||
<!-- <div style="margin-top: 2rem;"> | ||
<p style="color: #111; font-size: 0.875rem; font-weight: 500;">Thank you for joining Boilerplate</p> | ||
</div> --> | ||
|
||
<div style="margin-top: 2rem;"> | ||
<p>Regards,</p> | ||
<p>Boilerplate</p> | ||
</div> | ||
</td> | ||
</tr> | ||
</table> | ||
{% endblock %} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import pytest | ||
from fastapi.testclient import TestClient | ||
from main import app | ||
from api.db.database import get_db | ||
from unittest.mock import MagicMock, patch | ||
from api.v1.models import * | ||
from api.v1.models import User | ||
from api.v1.services.user import user_service | ||
from uuid_extensions import uuid7 | ||
from fastapi import status | ||
|
@@ -47,6 +46,14 @@ | |
"status_code": 201, | ||
} | ||
|
||
# Mock the BackgroundTasks and email sending function | ||
@pytest.fixture(scope='module') | ||
def mock_send_email(): | ||
with patch("api.core.dependencies.email_sender.send_email", return_value=None) as mock_email_sending: | ||
with patch("fastapi.BackgroundTasks.add_task") as add_task_mock: | ||
# Override the add_task method to simulate direct function call | ||
add_task_mock.side_effect = lambda func, *args, **kwargs: func(*args, **kwargs) | ||
yield mock_email_sending | ||
|
||
@pytest.fixture | ||
def mock_db_session(_=MagicMock()): | ||
|
@@ -71,16 +78,17 @@ def create_mock_super_admin(_): | |
|
||
|
||
@pytest.mark.parametrize("data", [squeeze1, squeeze2, squeeze3]) | ||
@pytest.mark.usefixtures("mock_db_session") | ||
def test_create_squeeze_page(mock_db_session, data): | ||
@pytest.mark.usefixtures("mock_db_session", "mock_send_email") | ||
def test_create_squeeze_page(mock_db_session, data, mock_send_email): | ||
"""Test create squeeze page.""" | ||
create_mock_super_admin(mock_db_session) | ||
tok = client.post( | ||
LOGIN_URI, json={"email": "[email protected]", "password": "P@ssw0rd"} | ||
).json() | ||
print(tok) | ||
assert tok["status_code"] == status.HTTP_200_OK | ||
token = tok["access_token"] | ||
res = client.post(URI, json=data, headers=theader(token)) | ||
assert res.status_code == data["status_code"] | ||
assert res.json()['data']['title'] == data["title"] | ||
assert res.json()['data']['email'] == data["email"] | ||
assert res.json()['data']['email'] == data["email"] |
This file contains 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