more tests
This commit is contained in:
parent
5076f79aaa
commit
b3a5a36d9c
@ -1,8 +1,28 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
from unittest.mock import Mock
|
||||||
from owrx.property import Property
|
from owrx.property import Property
|
||||||
|
|
||||||
|
|
||||||
class PropertyTest(unittest.TestCase):
|
class PropertyTest(unittest.TestCase):
|
||||||
def testSimple(self):
|
def testValue(self):
|
||||||
prop = Property("testvalue")
|
prop = Property("testvalue")
|
||||||
self.assertEqual(prop.getValue(), "testvalue")
|
self.assertEqual(prop.getValue(), "testvalue")
|
||||||
|
|
||||||
|
def testChangeValue(self):
|
||||||
|
prop = Property("before")
|
||||||
|
prop.setValue("after")
|
||||||
|
self.assertEqual(prop.getValue(), "after")
|
||||||
|
|
||||||
|
def testInitialValueOnCallback(self):
|
||||||
|
prop = Property("before")
|
||||||
|
m = Mock()
|
||||||
|
prop.wire(m.method)
|
||||||
|
m.method.assert_called_once_with("before")
|
||||||
|
|
||||||
|
def testChangedValueOnCallback(self):
|
||||||
|
prop = Property("before")
|
||||||
|
m = Mock()
|
||||||
|
prop.wire(m.method)
|
||||||
|
m.reset_mock()
|
||||||
|
prop.setValue("after")
|
||||||
|
m.method.assert_called_with("after")
|
||||||
|
Loading…
Reference in New Issue
Block a user