Skip to content

Commit 13666dc

Browse files
authored
Merge pull request #1 from Imed7223/bug/correction-email
test email_login and ignore htmlcov and .coverage reports
2 parents 0ee421a + fb0077a commit 13666dc

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ lib
44
.Python
55
tests/
66
.envrc
7-
__pycache__
7+
__pycache__
8+
htmlcov/
9+
.coverage
10+

tests/unit/test_email_login.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import sys
2+
import os
3+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
4+
import pytest
5+
from server import app
6+
7+
@pytest.fixture
8+
def client():
9+
app.config['TESTING'] = True
10+
with app.test_client() as client:
11+
yield client
12+
13+
def test_login_with_valid_email(client):
14+
response = client.post('/showSummary',
15+
data={'email': 'simplylift@club.com'},
16+
follow_redirects=True)
17+
assert response.status_code == 200
18+
assert b'Welcome' in response.data
19+
20+
def test_login_with_invalid_email(client):
21+
response = client.post('/showSummary',
22+
data={'email': 'wrong@email.com'},
23+
follow_redirects=True)
24+
assert response.status_code == 200
25+
assert b"Sorry, that email wasn't found." in response.data

0 commit comments

Comments
 (0)