-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
40 lines (33 loc) · 1011 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
Title: conftest.py
Author: Eoin Farrell
Student Number: C00164354
Purpose: conftest.py consists of fixture functions in assisting data and application test files.
DOC: 24/11/2020
"""
import pytest
import app as webapp
import DBcm
from data_utils import get_data
# Credentials to access the DB to perform fixture functions such s clean_insertion.
testCredentials = {
"host": "127.0.0.1",
"user": "admin",
"password": "deckard2019",
"database": "guestBook",
}
@pytest.fixture
def clean_insertion():
"""
clean_insertion is called to remove test data placed in the signatures table
by exterior functions that perform inserts.
"""
yield
with DBcm.UseDatabase(testCredentials) as cursor:
del_SQL = "DELETE FROM signatures WHERE guestEmail='testEntry'"
cursor.execute(del_SQL)
# beginning of web application testing.
@pytest.fixture
def app():
app = webapp.app
return app