create filtering that prevents overwriting the device name
This commit is contained in:
0
test/property/filter/__init__.py
Normal file
0
test/property/filter/__init__.py
Normal file
17
test/property/filter/test_by_lambda.py
Normal file
17
test/property/filter/test_by_lambda.py
Normal file
@ -0,0 +1,17 @@
|
||||
from owrx.property.filter import ByLambda
|
||||
from unittest import TestCase
|
||||
from unittest.mock import Mock
|
||||
|
||||
|
||||
class TestByLambda(TestCase):
|
||||
def testPositive(self):
|
||||
mock = Mock(return_value=True)
|
||||
filter = ByLambda(mock)
|
||||
self.assertTrue(filter.apply("test_key"))
|
||||
mock.assert_called_with("test_key")
|
||||
|
||||
def testNegateive(self):
|
||||
mock = Mock(return_value=False)
|
||||
filter = ByLambda(mock)
|
||||
self.assertFalse(filter.apply("test_key"))
|
||||
mock.assert_called_with("test_key")
|
12
test/property/filter/test_by_property_name.py
Normal file
12
test/property/filter/test_by_property_name.py
Normal file
@ -0,0 +1,12 @@
|
||||
from owrx.property.filter import ByPropertyName
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
class ByPropertyNameTest(TestCase):
|
||||
def testNameIsInList(self):
|
||||
filter = ByPropertyName("test_key")
|
||||
self.assertTrue(filter.apply("test_key"))
|
||||
|
||||
def testNameNotInList(self):
|
||||
filter = ByPropertyName("test_key")
|
||||
self.assertFalse(filter.apply("other_key"))
|
Reference in New Issue
Block a user