Ejemplo n.º 1
0
 def test_load_playbook_file_bad_permissions(self):
     test_permissions = {'a': 42}
     filepath = os.path.join(test_data_path, 'test.json')
     with open(filepath, 'w') as file_out:
         file_out.write(json.dumps(test_permissions))
     os.chmod(filepath, 0o444)
     self.assertIsNone(Loader.load_playbook(filepath))
Ejemplo n.º 2
0
 def test_load_playbook(self):
     workflows = [Workflow('something'), Workflow('something2')]
     playbook = Playbook('test', workflows=workflows)
     filepath = os.path.join(test_data_path, 'test.json')
     with open(filepath, 'w') as file_out:
         file_out.write(json.dumps(playbook.read()))
     loaded = Loader.load_playbook(filepath)
     self.assertIsInstance(loaded, Playbook)
     self.assertEqual(loaded.name, 'test')
Ejemplo n.º 3
0
 def test_load_playbook_invalid_app(self):
     workflow_json = {
         "name":
         "test_workflow",
         "start":
         "start",
         "actions": [{
             "action": "invalid",
             "app": "Invalid",
             "name": "start",
             "branches": []
         }]
     }
     playbook_json = {'name': 'test_playbook', 'workflows': [workflow_json]}
     filepath = os.path.join(test_data_path, 'test.json')
     with open(filepath, 'w') as file_out:
         file_out.write(json.dumps(playbook_json))
     self.assertIsNone(Loader.load_playbook(filepath))
Ejemplo n.º 4
0
 def test_load_playbook_invalid_json_format(self):
     test_invalid_json = 'something not json'
     filepath = os.path.join(test_data_path, 'test.json')
     with open(filepath, 'w') as file_out:
         file_out.write(test_invalid_json)
     self.assertIsNone(Loader.load_playbook(filepath))
Ejemplo n.º 5
0
 def test_load_playbook_file_dne(self):
     self.assertIsNone(
         Loader.load_playbook('/some/invalid/workflow.invalid'))