Exemplo n.º 1
0
 def test_field_group_at_path_for_leaf_object_field_creates_the_section(self):
     all_fields = {
         'network': {
             'field_details': {
                 'name': 'network',
             },
             'fields': {
                 'ingress': {
                     'field_details': {
                         'name': 'network.ingress',
                         'type': 'object'
                     }
                 }
             }
         }
     }
     ingress_subfields = finalizer.field_group_at_path('network.ingress', all_fields)
     self.assertEqual(ingress_subfields, {})
     self.assertEqual(all_fields['network']['fields']['ingress']['fields'], {})
Exemplo n.º 2
0
 def test_field_group_at_path_leaf_field_not_field_group(self):
     all_fields = self.schema_server()
     with self.assertRaisesRegex(
             ValueError, "Field server\.ip \(type ip\) already exists"):
         finalizer.field_group_at_path('server.ip', all_fields)
Exemplo n.º 3
0
 def test_field_group_at_path_missing_nested_path(self):
     all_fields = self.schema_server()
     with self.assertRaisesRegex(ValueError,
                                 "Field server.nonexistent not found"):
         finalizer.field_group_at_path('server.nonexistent', all_fields)
Exemplo n.º 4
0
 def test_field_group_at_path_find_nested_destination(self):
     all_fields = self.schema_process()
     fields = finalizer.field_group_at_path('process.thread', all_fields)
     self.assertIn('id', fields.keys(),
                   "should return the dictionary of process.thread fields")
     self.assertEqual('thread.id', fields['id']['field_details']['name'])
Exemplo n.º 5
0
 def test_field_group_at_path_root_destination(self):
     all_fields = self.schema_server()
     fields = finalizer.field_group_at_path('server', all_fields)
     self.assertIn('ip', fields.keys(),
                   "should return the dictionary of server fields")