Exemple #1
0
 def test_teflo_load_from_yaml_05():
     data = list()
     data.append(template_render('../assets/correct_include_descriptor.yml', os.environ))
     data.append(template_render('../assets/common.yml', os.environ))
     teflo = Teflo(data_folder='/tmp')
     teflo.load_from_yaml(data)
     assert teflo.scenario.child_scenarios
Exemple #2
0
 def test_validate_labels_02(scenario_labels):
     """ this test verifies validate_labels throws error when wrong skip_labels is provided"""
     teflo = Teflo(data_folder='/tmp', workspace='/tmp', skip_labels=('lab1','label2'))
     with pytest.raises(TefloError) as ex:
         teflo._validate_labels()
     assert "No resources were found corresponding to the label/skip_label lab1. " \
            "Please check the labels provided during the run match the ones in "\
            "scenario descriptor file" in ex.value.args
Exemple #3
0
 def test_create_teflo_instance_with_labels():
     """this test is to verify teflo instance gets created when labels/skip_labels are passed"""
     teflo = Teflo(data_folder='/tmp',
                   workspace='/tmp',
                   labels=('lab1', 'lab2'),
                   skip_labels=('lab3', ))
     assert teflo.teflo_options['labels'] == ('lab1', 'lab2')
     assert teflo.teflo_options['skip_labels'] == ('lab3', )
Exemple #4
0
 def test_artifacts_folder_created():
     teflo = Teflo(data_folder='/tmp')
     print(teflo.data_folder)
     assert (os.path.exists(os.path.join(teflo.config['RESULTS_FOLDER'], 'artifacts')))
Exemple #5
0
def teflo1():
    teflo = Teflo(data_folder='/tmp',
                  workspace='/tmp',
                  labels=('label1', 'label2'),
                  skip_notify=('note01', ))
    return teflo
Exemple #6
0
 def test_data_folder_property():
     teflo = Teflo(data_folder='/tmp')
     assert teflo.data_folder == teflo.config['DATA_FOLDER']
Exemple #7
0
 def test_results_file_property():
     teflo = Teflo(data_folder='/tmp')
     assert teflo.results_file == os.path.join(
         teflo.data_folder, RESULTS_FILE)
Exemple #8
0
 def test_create_teflo_instance_03():
     """verifies teflo instance is created when data folder and workspace is provided and kwargs in none"""
     teflo = Teflo(data_folder='/tmp', workspace='/tmp')
     assert '/tmp' in teflo.config['DATA_FOLDER']
     assert teflo.workspace == '/tmp'
     assert teflo.teflo_options == {}
Exemple #9
0
 def test_create_teflo_instance_05(mock_method):
     with pytest.raises(TefloError):
         mock_method.side_effect = IOError()
         mock_method.side_effect.errno = 13
         Teflo(data_folder='/tmp', workspace='/tmp')
Exemple #10
0
 def test_create_teflo_instance_01():
     teflo = Teflo(data_folder='/tmp')
     assert isinstance(teflo, Teflo)
Exemple #11
0
 def test_create_teflo_instance_02():
     teflo = Teflo(log_level='info', data_folder='/tmp')
     assert teflo.config['LOG_LEVEL'] == 'info'
Exemple #12
0
 def test_static_inventory_folder():
     teflo = Teflo(import_name='__main__', data_folder='/tmp')
     assert teflo.static_inv_dir
     assert teflo.config['INVENTORY_FOLDER'] == '/tmp'
Exemple #13
0
 def test_teflo_load_from_yaml_01(mock_method):
     mock_method.return_value = {}
     teflo = Teflo(data_folder='/tmp')
     teflo.load_from_yaml([''])
Exemple #14
0
 def test_name_property_03():
     sys.modules['__main__'].__file__ = None
     teflo = Teflo(import_name='__main__', data_folder='/tmp')
     assert teflo.name == '__main__'
Exemple #15
0
 def test_name_property_02():
     teflo = Teflo(import_name='__main__', data_folder='/tmp')
     assert teflo.name != 'teflo'
Exemple #16
0
 def test_name_property_01():
     teflo = Teflo(data_folder='/tmp')
     assert teflo.name == 'teflo'
Exemple #17
0
 def test_teflo_load_from_yaml_03():
     data = list()
     data.append(template_render('../assets/descriptor.yml', os.environ))
     teflo = Teflo(data_folder='/tmp')
     teflo.config['CREDENTIALS'] = [{'name': 'provider'}]
     teflo.load_from_yaml(data)
Exemple #18
0
 def test_teflo_load_from_yaml_04():
     data = list()
     data.append(template_render('../assets/descriptor.yml', os.environ))
     teflo = Teflo(data_folder='/tmp')
     teflo.load_from_yaml(data)