-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_swot_analysis.py
38 lines (29 loc) · 1009 Bytes
/
test_swot_analysis.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
import unittest
from datetime import datetime
from swot_analysis import SWOTAnalysis
class MockDB:
def __init__(self):
self.entries = []
def insert_one(self, entry):
self.entries.append(entry)
def find(self):
return self.entries
class TestSWOTAnalysis(unittest.TestCase):
def setUp(self):
self.mock_db = MockDB()
self.swot_analysis = SWOTAnalysis(self.mock_db)
def test_create_analysis(self):
entry = self.swot_analysis.create_analysis(
strengths="Strong brand",
weaknesses="Limited reach",
opportunities="New market",
threats="Competitors"
)
self.assertIn(entry, self.mock_db.find())
def test_create_analysis_with_empty_fields(self):
entry = self.swot_analysis.create_analysis(
strengths="", weaknesses="", opportunities="", threats=""
)
self.assertIn(entry, self.mock_db.find())
if __name__ == "__main__":
unittest.main()