-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_team_code_busters.py
More file actions
89 lines (72 loc) · 2.94 KB
/
Copy pathtest_team_code_busters.py
File metadata and controls
89 lines (72 loc) · 2.94 KB
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 unittest
from pii_scan import show_aggie_pride, analyze_text
class TestTeamCodeBusters(unittest.TestCase):
def test_aggie_pride(self):
"""Test to make sure the Aggie Pride function works"""
self.assertEqual('Aggie Pride - Worldwide', show_aggie_pride())
def test_birthdate_detect(self):
# Positive test case
results = analyze_text(" My birthdate: 11/01/2002")
print(results)
self.assertIn('BIRTHDATE', str(results))
# Negative test case
results = analyze_text(" My birthdate: ABC/de/frog.")
print(results)
self.assertNotIn('BIRTHDATE', str(results))
def test_philisophical_belief_detect(self):
# positive test case
results = analyze_text("marxism")
print(results)
self.assertIn('PHILBELIEFS', str(results))
# negative test case
results = analyze_text("christian")
print(results)
self.assertNotIn('PHILBELIEFS', str(results))
def test_credit_card_score_detect(self):
"""Test to make sure credit score is detected"""
# positive testcase
results = analyze_text('Credit score: 450')
print(results)
self.assertIn('CREDIT_SCORE', str(results))
# negative testcase
results = analyze_text('Credit score: 250')
print(results)
self.assertNotIn('CREDIT_SCORE', str(results))
# negative testcase
results = analyze_text('Credit score: 851')
print(results)
self.assertNotIn('CREDIT_SCORE', str(results))
def test_eye_color_detect(self):
"""Testing if eye color is detected"""
# positive test case
results = analyze_text('Eye color: red')
print(results)
self.assertIn('EYE_COLOR', str(results))
# negative test case
results = analyze_text('Eye color: Ball')
print(results)
self.assertNotIn('EYE_COLOR', str(results))
def test_udid(self):
"""Testing if UDID is detected"""
# positive test case
results = analyze_text('A7C9B2A4-F6E82B43C580E24F')
print(results)
self.assertIn('UDID', str(results))
# negative test case
results = analyze_text('K7Y9J2A4-R6T8X1')
print(results)
self.assertNotIn('UDID', str(results))
def test_health_insurance_policy_number_detect(self):
"""Test to ensure policy number is detected"""
#positive testcase
results = analyze_text('My insurance policy number is XYZ123456789')
print(results)
self.assertIn('INSURANCE_POLICY', str(results))
#negative testcase
results = analyze_text('My insurance policy number is ABC123456789011')
print(results)
self.assertNotIn('INSURANCE_POLICY', str(results))
#negative testcase
results = analyze_text('My insurance policy number is ABCDE12345678')
print(results)
self.assertNotIn('INSURANCE_POLICY', str(results))