Esempio n. 1
0
def test_destination_problem_exception(*_):
    profile_name = 'product/1.0.0/my_profile.yaml'
    destination = '/problematic/destination'
    with pytest.raises(OSError):
        new_profile_rendered(profile_name, destination, None)
    # noinspection PyUnresolvedReferences
    yacfg.output.ensure_output_path.assert_called()
    # noinspection PyUnresolvedReferences
    yacfg.output.write_output.assert_not_called()
Esempio n. 2
0
def test_true_no_destination(*_):
    profile_name = 'product/1.0.0/my_profile.yaml'
    destination = ''
    _, expected_data = fake_load_tuned_profile_no_defaults()
    expected_data = '# {} tuning file generated from profile {}{}---{}{}'.format(
        NAME, profile_name, os.linesep, os.linesep, expected_data)

    new_profile_rendered(profile_name, destination, None)
    # noinspection PyUnresolvedReferences
    yacfg.output.ensure_output_path.assert_not_called()
    # noinspection PyUnresolvedReferences
    yacfg.output.write_output.assert_called_with(destination, destination,
                                                 expected_data)
def test_true_no_defaults(*_):
    profile_name = "product/1.0.0/my_profile.yaml"
    destination_name = "destination_profile.yaml"
    destination_path = "/profile/destination/path"
    destination = os.path.join(destination_path, destination_name)
    _, expected_data = fake_load_tuned_profile_no_defaults()
    expected_data = "# {} tuning file generated from profile {}{}---{}{}".format(
        NAME, profile_name, os.linesep, os.linesep, expected_data)

    new_profile_rendered(profile_name, destination, None)
    # noinspection PyUnresolvedReferences
    yacfg.output.ensure_output_path.assert_called_with(destination_path)
    # noinspection PyUnresolvedReferences
    yacfg.output.write_output.assert_called_with(destination_name,
                                                 destination_path,
                                                 expected_data)