Beispiel #1
0
 def test_choices_idempotence_prev27(self):
     test_values = {
         "id": 123,
         "choices_test": {
             "value": 1,
             "label": "test",
         },
     }
     test = Record(test_values, None, None)
     test.choices_test = 1
     self.assertFalse(test._diff())
Beispiel #2
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],
     }
     test = Record(test_values, None, None)
     test.tags.append("baz")
     test.nested_dict = 1
     test.string_field = "foobaz"
     self.assertEqual(test._diff(), {"tags", "nested_dict", "string_field"})
Beispiel #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)