Skip to content

Commit

Permalink
Merge branch 'dev' into feat/delete-blog-like
Browse files Browse the repository at this point in the history
  • Loading branch information
chimeziriobioha authored Aug 24, 2024
2 parents 274ca39 + c71f6dc commit 00e7c3d
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 16 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/regression-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run Regression Tests

on:
schedule:
- cron: '*/15 * * * *' # Runs every 15 minutes
workflow_dispatch:


jobs:
run-newman-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install Newman
run: |
npm install -g newman
- name: Run Newman Tests
run: |
newman run qa_tests/Boilerplate-status-page.postman_collection.json -r json --reporter-json-export=result.json --suppress-exit-code
- name: Copy result.json to server
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
source: "result.json"
target: "/home/${{ secrets.USERNAME }}/hng_boilerplate_python_fastapi_web/staging"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ MANIFEST
test_case1.py
api/core/dependencies/mailjet.py
tests/v1/waitlist/waitlist_test.py

result.json
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
Expand Down
27 changes: 15 additions & 12 deletions api/v1/routes/newsletter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,23 @@ async def sub_newsletter(
# Save user to the database
NewsletterService.create(db, request)

link = "https://anchor-python.teams.hng.tech/"

# Send email in the background
background_tasks.add_task(
send_email,
recipient=request.email,
template_name="newsletter-subscription.html",
subject="Thank You for Subscribing to HNG Boilerplate Newsletters",
context={"link": link},
)
link = "https://anchor-python.teams.hng.tech/"

# Send email in the background
background_tasks.add_task(
send_email,
recipient=request.email,
template_name="newsletter-subscription.html",
subject="Thank You for Subscribing to HNG Boilerplate Newsletters",
context={"link": link},
)
message = "Thank you for subscribing to our newsletter."
else:
message = "You have already subscribed to our newsletter. Thank you."

return success_response(
message="Thank you for subscribing to our newsletter.",
status_code=status.HTTP_201_CREATED,
message=message,
status_code=status.HTTP_200_OK,
)


Expand Down
11 changes: 8 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ alembic==1.13.2
annotated-types==0.7.0
anyio==4.4.0
astroid==3.2.4
async-timeout==4.0.3
attrs==23.2.0
Authlib==1.3.1
autopep8==2.3.1
Expand All @@ -23,6 +24,7 @@ colorama==0.4.6
cryptography==43.0.0
cssselect==1.2.0
cssutils==2.11.1
Deprecated==1.2.14
dill==0.3.8
distlib==0.3.8
dnspython==2.6.1
Expand All @@ -37,17 +39,18 @@ filelock==3.15.4
flake8==7.1.0
frozenlist==1.4.1
greenlet==3.0.3
slowapi==0.1.9
h11==0.14.0
httpcore==1.0.5
httptools==0.6.1
httpx==0.27.0
identify==2.6.0
idna==3.7
importlib_resources==6.4.4
iniconfig==2.0.0
isort==5.13.2
itsdangerous==2.2.0
Jinja2==3.1.4
limits==3.13.0
lxml==5.2.2
Mako==1.3.5
markdown-it-py==3.0.0
Expand All @@ -61,8 +64,8 @@ nodeenv==1.9.1
packaging==24.1
passlib==1.7.4
pathspec==0.12.1
pillow==10.4.0
pipdeptree==2.23.1
Pillow==10.4.0
platformdirs==4.2.2
pluggy==1.5.0
pre-commit==3.7.1
Expand Down Expand Up @@ -94,9 +97,11 @@ rich==13.7.1
rsa==4.9
shellingham==1.5.4
six==1.16.0
slowapi==0.1.9
sniffio==1.3.1
SQLAlchemy==2.0.31
starlette==0.37.2
stripe==10.7.0
tomli==2.0.1
tomlkit==0.13.0
twilio==9.2.3
Expand All @@ -110,5 +115,5 @@ virtualenv==20.26.3
watchfiles==0.22.0
webencodings==0.5.1
websockets==12.0
wrapt==1.16.0
yarl==1.9.4
stripe==10.7.0

0 comments on commit 00e7c3d

Please sign in to comment.