-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesting.py
89 lines (60 loc) · 2.75 KB
/
testing.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
import tkinter as tk
import Paycheck_Calculator as pc
import unittest
class TestPaycheckCalculator(unittest.TestCase):
def test_valid_inputs(self):
root = tk.Tk()
app = pc.Week_Window(root)
app.friday_clock_in.insert('1:00am')
app.friday_clock_out.insert('6:00pm')
app.saturday_clock_in.insert('2:00am')
app.saturday_clock_out.insert('7:00pm')
app.sunday_clock_in.insert('3:00am')
app.sunday_clock_out.insert('8:00pm')
app.monday_clock_in.insert('4:00am')
app.monday_clock_out.insert('9:00pm')
app.tuesday_clock_in.insert('5:00am')
app.tuesday_clock_out.insert('10:00pm')
app.wednesday_clock_in.insert('6:00am')
app.wednesday_clock_out.insert('11:00pm')
app.thursday_clock_in.insert('7:00am')
app.thursday_clock_out.insert('11:30pm')
app.calculate_paycheck()
# Checks the total paycheck
self.assertEqual(app.total_paycheck_label.cget('text'), '2797.36')
# Checks the total hours worked
self.assertEqual(app.total_hours_worked_label.cget('text'), '118.00 hours')
# Checks the total tax paid
self.assertEqual(app.total_taxes_paid_label.cget('text'), '$709.42')
def test_checkmarks(self):
root = tk.Tk()
app = pc.Week_Window(root)
app.friday_clock_in.insert('1:00am')
app.friday_clock_out.insert('6:00pm')
app.took_lunch_friday.set(True)
app.saturday_clock_in.insert('2:00am')
app.saturday_clock_out.insert('7:00pm')
app.took_lunch_saturday.set(True)
app.sunday_clock_in.insert('3:00am')
app.sunday_clock_out.insert('8:00pm')
app.took_lunch_sunday.set(True)
app.monday_clock_in.insert('4:00am')
app.monday_clock_out.insert('9:00pm')
app.took_lunch_monday.set(True)
app.tuesday_clock_in.insert('5:00am')
app.tuesday_clock_out.insert('10:00pm')
app.took_lunch_tuesday.set(True)
app.wednesday_clock_in.insert('6:00am')
app.wednesday_clock_out.insert('11:00pm')
app.took_lunch_wednesday.set(True)
app.thursday_clock_in.insert('7:00am')
app.thursday_clock_out.insert('11:30pm')
app.took_lunch_thursday.set(True)
app.calculate_paycheck()
# Checks the total paycheck
self.assertEqual(app.total_paycheck_label.cget('text'), '2704.26')
# Checks the total hours worked
self.assertEqual(app.total_hours_worked_label.cget('text'), '115.00 hours')
# Checks the total tax paid
self.assertEqual(app.total_taxes_paid_label.cget('text'), '$685.81')
unittest.main()