-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestModel.py
47 lines (40 loc) · 1.17 KB
/
testModel.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
import os
import sys
import gzip
import random
import unittest
import optionsModel
class TestOptionsModel(unittest.TestCase):
def setUp(self):
self.model = optionsModel.OptionsModel()
self.assertTrue(self.model.getSpeed() == 50)
self.assertTrue(self.model.getSync() == 3600)
self.assertTrue(not self.model.getStop())
self.assertTrue(self.model.getLaunch())
self.assertTrue(self.model.getLeft())
def testURL(self):
l = []
l.append("cat")
self.model.getURLs().append("cat")
self.assertTrue(self.model.getURLs() == l)
def testLeft(self):
self.model.setLeft(0)
self.assertTrue(self.model.getLeft() == 0)
def testLaunch(self):
self.model.setLaunch(0)
self.assertTrue(self.model.getLaunch() == 0)
def testStop(self):
self.model.setStop(1)
self.assertTrue(self.model.getStop() == 1)
def testSync(self):
self.model.setSync(0)
self.assertTrue(self.model.getSync() == 0)
def testSpeed(self):
self.model.setSpeed(50)
self.assertTrue(self.model.getSpeed() == 50)
self.model.setSpeed(150)
self.assertTrue(self.model.getSpeed() == 100)
self.model.setSpeed(-50)
self.assertTrue(self.model.getSpeed() == 0)
if __name__ == "__main__":
unittest.main()