-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmtest.py
More file actions
26 lines (19 loc) · 753 Bytes
/
mtest.py
File metadata and controls
26 lines (19 loc) · 753 Bytes
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
""" Tests for Model class """
import unittest
from unittest.mock import patch
from src.Event import Event
import test_helpers as th
class TestModelClass(unittest.TestCase):
@patch('src.Model.Model')
def test_event_create(self, Model):
model = Model()
model.event_list.return_value = [Event('test', 'test')]
elist = model.events_list()
self.assertNotEqual(elist, [])
@patch('src.Model.Model.remove_event', side_effect=th.delete_event)
def test_remove_event(self, remove_event):
self.assertEqual(remove_event('test', [Event('test', 'test')]), [])
with self.assertRaises(Exception):
remove_event('t', [Event('test', 'test')])
if __name__ == "__main__":
unittest.main()