add test for nested_delete where key's value is falsy
This commit is contained in:
parent
5403e53094
commit
ff609192f5
1 changed files with 28 additions and 0 deletions
|
|
@ -102,6 +102,15 @@ class BaseLookUpApi(TestCase):
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.sample_data5 = {
|
||||||
|
"key1": {
|
||||||
|
"key2": True,
|
||||||
|
"key3": False,
|
||||||
|
"key4": 5,
|
||||||
|
"key5": 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class TestNestedDelete(BaseLookUpApi):
|
class TestNestedDelete(BaseLookUpApi):
|
||||||
def test_sample_data1(self):
|
def test_sample_data1(self):
|
||||||
|
|
@ -126,6 +135,25 @@ class TestNestedDelete(BaseLookUpApi):
|
||||||
result = {"values": [{"checks": [{}]}]}
|
result = {"values": [{"checks": [{}]}]}
|
||||||
self.assertEqual(result, nested_delete(self.sample_data3, "monitoring_zones"))
|
self.assertEqual(result, nested_delete(self.sample_data3, "monitoring_zones"))
|
||||||
|
|
||||||
|
def test_false_bool(self):
|
||||||
|
result = {
|
||||||
|
"key1": {
|
||||||
|
"key2": True,
|
||||||
|
"key4": 5,
|
||||||
|
"key5": 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.assertEqual(result, nested_delete(self.sample_data5, "key3"))
|
||||||
|
|
||||||
|
def test_falseish_number(self):
|
||||||
|
result = {
|
||||||
|
"key1": {
|
||||||
|
"key2": True,
|
||||||
|
"key3": False,
|
||||||
|
"key4": 5,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.assertEqual(result, nested_delete(self.sample_data5, "key5"))
|
||||||
|
|
||||||
class TestNestedUpdate(BaseLookUpApi):
|
class TestNestedUpdate(BaseLookUpApi):
|
||||||
def test_sample_data1(self):
|
def test_sample_data1(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue