-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_database.py
95 lines (68 loc) · 2.69 KB
/
test_database.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import pytest
from database import *
def test_add_course_valid_name():
assert add_course("Introduction to Python and Programming Concepts") == True
def test_add_course_existing_value():
with pytest.raises(ValueError):
add_course("Introduction to Python and Programming Concepts")
def test_add_course_empty_string():
with pytest.raises(ValueError):
add_course("")
def test_add_course_whitesapce_string():
with pytest.raises(ValueError):
add_course(" ")
def test_delete_course_existant_course():
assert delete_course("Introduction to Python and Programming Concepts") == True
def test_delete_course_non_existant_course():
with pytest.raises(ValueError):
delete_course("test")
def test_delete_course_empty_string():
with pytest.raises(ValueError):
delete_course("")
def test_delete_course_whitespace_string():
with pytest.raises(ValueError):
delete_course(" ")
def test_add_professor_valid_name():
assert add_professor("Dr. Jack Smith") == True
def test_add_professor_existing_value():
with pytest.raises(ValueError):
add_professor("Dr. Jack Smith")
def test_add_professor_empty_string():
with pytest.raises(ValueError):
add_professor("")
def test_add_professor_whitesapce_string():
with pytest.raises(ValueError):
add_professor(" ")
def test_delete_professor_existant_professor():
assert delete_professor("Dr. Jack Smith") == True
def test_delete_professor_non_existant_professor():
with pytest.raises(ValueError):
delete_professor("Dr. test test")
def test_delete_professor_empty_string():
with pytest.raises(ValueError):
delete_professor("")
def test_delete_professor_whitespace_string():
with pytest.raises(ValueError):
delete_professor(" ")
def test_add_classroom_valid_name():
assert add_classroom("c 62") == True
def test_add_classroom_existing_value():
with pytest.raises(ValueError):
add_classroom("c 62")
def test_add_classroom_empty_string():
with pytest.raises(ValueError):
add_classroom("")
def test_add_classroom_whitesapce_string():
with pytest.raises(ValueError):
add_classroom(" ")
def test_delete_classroom_existant_classroom():
assert delete_classroom("c 62") == True
def test_delete_classroom_non_existant_professor():
with pytest.raises(ValueError):
delete_classroom("c 62")
def test_delete_classroom_empty_string():
with pytest.raises(ValueError):
delete_classroom("")
def test_delete_classroom_whitespace_string():
with pytest.raises(ValueError):
delete_classroom(" ")