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
|
import unittest
from pynetbox.models.extras import ConfigContexts
class ExtrasTestCase(unittest.TestCase):
def test_config_contexts(self):
test_values = {
"data": {
"test_int": 123,
"test_str": "testing",
"test_list": [1, 2, 3],
}
}
test = ConfigContexts(test_values, None, None)
self.assertTrue(test)
def test_config_contexts_diff_str(self):
test_values = {
"data": {
"test_int": 123,
"test_str": "testing",
"test_list": [1, 2, 3],
"test_dict": {"foo": "bar"},
}
}
test = ConfigContexts(test_values, None, None)
test.data["test_str"] = "bar"
self.assertEqual(test._diff(), {"data"})
def test_config_contexts_diff_dict(self):
test_values = {
"data": {
"test_int": 123,
"test_str": "testing",
"test_list": [1, 2, 3],
"test_dict": {"foo": "bar"},
}
}
test = ConfigContexts(test_values, None, None)
test.data["test_dict"].update({"bar": "foo"})
self.assertEqual(test._diff(), {"data"})
|