more tests

This commit is contained in:
Jakob Ketterl 2020-03-22 19:42:59 +01:00
parent 5076f79aaa
commit b3a5a36d9c

View File

@ -1,8 +1,28 @@
import unittest
from unittest.mock import Mock
from owrx.property import Property
class PropertyTest(unittest.TestCase):
def testSimple(self):
def testValue(self):
prop = Property("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")