예제 #1
0
 def test_should_save_preferences(self, mock_load_config_file):
     config_path = "my_config_file.yaml"
     settings.save_config_file_preferences(config_path)
     assert settings["config_path"].endswith(
         "my_config_file.yaml")
     mock_load_config_file.assert_called_with(
         "my_config_file.yaml")
예제 #2
0
                def test_should_save_preferences(self):
                    with open(DEFAULT_CONFIG_PATH, "w") as out_file:
                        out_file.write("template: path/template.jinja")

                    settings.save_config_file_preferences()
                    assert settings["template"] == "path/template.jinja"

                    os.remove(DEFAULT_CONFIG_PATH)
예제 #3
0
                def test_should_save_preferences(self):
                    with open(DEFAULT_CONFIG_PATH, "w") as out_file:
                        out_file.write("reporter: html")

                    settings.save_config_file_preferences()
                    assert settings["reporter"] == "html"

                    os.remove(DEFAULT_CONFIG_PATH)
예제 #4
0
 def test_should_save_preferences_3(
     self,
     mock_doesnt_have_local_config_file,
     mock_has_global_config_file,
     mock_load_config_file,
 ):
     settings.save_config_file_preferences()
     assert settings["config_path"].endswith("scanapi/scanapi.conf")
     assert mock_load_config_file.called
예제 #5
0
    def test_should_raise_exception(self):
        with raises(FileNotFoundError) as excinfo:
            config_path = "invalid/my_config_file.yaml"
            settings.save_config_file_preferences(config_path)

        assert (
            str(excinfo.value)
            == "[Errno 2] No such file or directory: 'invalid/my_config_file.yaml'"
        )
예제 #6
0
                def test_should_save_preferences(self):
                    config_path = "my_config_file.yaml"
                    with open(config_path, "w") as out_file:
                        out_file.write("template: template.jinja")

                    settings.save_config_file_preferences(config_path)
                    assert settings["template"] == "template.jinja"

                    os.remove(config_path)
예제 #7
0
                def test_should_save_preferences(self):
                    config_path = "my_config_file.yaml"
                    with open(config_path, "w") as out_file:
                        out_file.write("reporter: html")

                    settings.save_config_file_preferences(config_path)
                    assert settings["reporter"] == "html"

                    os.remove(config_path)
예제 #8
0
 def test_should_save_preferences_2(
     self, mock_has_local_config_file, mock_load_config_file
 ):
     settings.save_config_file_preferences()
     assert settings["config_path"].endswith("./scanapi.conf")
     mock_load_config_file.assert_called_with("./scanapi.conf")
예제 #9
0
 def test_should_not_change_preferences(self):
     settings.save_config_file_preferences()
     assert settings["spec_path"] == "path/spec-path.yaml"
예제 #10
0
 def test_should_not_change_preferences(self):
     settings.save_config_file_preferences()
     assert settings["reporter"] == "markdown"