Skip to content

Commit 26b223a

Browse files
committed
added tests
1 parent a63d580 commit 26b223a

File tree

3 files changed

+48
-3
lines changed

3 files changed

+48
-3
lines changed

pytest.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[pytest]
22
markers =
33
notifications: mark tests that check notifications
4-
e2e: for end to end tests
5-
pubs: for scape_pubs cron
4+
e2etests: for end to end tests
5+
pubs: for scape_pubs cron
6+
real: send email in real

tests/e2e/e2etests.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import pytest
2+
from db import enums
3+
import os
4+
from datetime import datetime
5+
from scrape_pubs import scrape_pubs
6+
from notify import notify
7+
8+
@pytest.mark.e2etests
9+
def test_scrape_pubs_techteams(db):
10+
conn = db.get_connection()
11+
12+
db.add_publisher(conn, "aws", "techteam")
13+
db.add_subscription(conn, "newemail@gmail.com", enums.PublisherCategory.SOFTWARE_ENGINEERING.value, 1)
14+
15+
scrape_pubs(db, conn)
16+
17+
posts = db.get_posts(conn)
18+
19+
assert len(posts) > 10
20+
21+
notify(db, conn)
22+
23+
notifications = db.get_notifications_by_email(conn, "newemail@gmail.com")
24+
25+
assert len(notifications) == 0
26+
27+
post = posts[0]
28+
29+
db.update_post_label(conn, post['id'], enums.PublisherCategory.SOFTWARE_ENGINEERING.value)
30+
conn.commit()
31+
32+
notify(db, conn)
33+
assert len(notifications) == 1
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+

tests/e2e/test_send_email_e2e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_send_email_e2e(db, dummy_smtp):
124124

125125
conn.close()
126126

127-
@pytest.mark.e2e
127+
@pytest.mark.real
128128
def test_send_email_real(db):
129129
"""
130130
End-to-end test for sending a real email via configured SMTP server.

0 commit comments

Comments
 (0)