예제 #1
0
 def test_diff(self):
     test_values = {
         "id": 123,
         "custom_fields": {
             "foo": "bar"
         },
         "string_field": "foobar",
         "int_field": 1,
         "nested_dict": {
             "id": 222,
             "name": "bar"
         },
         "tags": ["foo", "bar"],
         "int_list": [123, 321, 231],
         "local_context_data": {
             "data": ["one"]
         },
     }
     test = Record(test_values, None, None)
     test.tags.append("baz")
     test.nested_dict = 1
     test.string_field = "foobaz"
     test.local_context_data["data"].append("two")
     self.assertEqual(
         test._diff(),
         {"tags", "nested_dict", "string_field", "local_context_data"})
예제 #2
0
 def test_choices_idempotence_v28(self):
     test_values = {
         "id": 123,
         "choices_test": {
             "value": "test",
             "label": "test"
         },
     }
     test = Record(test_values, None, None)
     test.choices_test = "test"
     self.assertFalse(test._diff())
예제 #3
0
 def test_diff_append_records_list(self):
     test_values = {
         "id":
         123,
         "tagged_vlans": [{
             "id": 1,
             "url": "http://localhost:8000/api/ipam/vlans/1/",
             "vid": 1,
             "name": "test1",
             "display_name": "test1",
         }],
     }
     test_obj = Record(test_values, Mock(base_url="test"), None)
     test_obj.tagged_vlans.append(1)
     test = test_obj._diff()
     self.assertFalse(test)