Beispiel #1
0
 def test_read_multi_doc_with_doc_separator_at_start(self):
     file_content = load_example_file('multidoc_separator_at_start')
     docs = ObjectConfigurationDocument(file_content)
     objects = docs.read()
     self.assertEqual(len(objects), 2)
     self.assertEqual(objects[0].kind, 'ConfigMap')
     self.assertEqual(objects[1].kind, 'Ingress')
Beispiel #2
0
 def test_read_multi_doc_with_emptydoc_in_middle(self):
     file_content = load_example_file('multidoc_emptydoc_in_middle')
     docs = ObjectConfigurationDocument(file_content)
     objects = docs.read()
     self.assertEqual(len(objects), 2)
     self.assertEqual(objects[0].kind, 'ConfigMap')
     self.assertEqual(objects[1].kind, 'Ingress')
Beispiel #3
0
 def test_read_invalid_yaml(self):
     file_content = load_example_file('invalid_yaml')
     docs = ObjectConfigurationDocument(file_content)
     with self.assertRaises(yaml.YAMLError) as context:
         docs.read()
Beispiel #4
0
 def test_read_single_doc(self):
     file_content = load_example_file('simple')
     docs = ObjectConfigurationDocument(file_content)
     objects = docs.read()
     self.assertEqual(len(objects), 1)
     self.assertEqual(objects[0].kind, 'ConfigMap')