def test_continuous_integration__set_seed(monkeypatch): with in_temp_dir(): write_config() cmd = Command(FakeApp, FakeCI) cmd.run(['ci', '--seed', '1234']) FakeCI.runner.run.assert_called_once_with(seed="1234", show_logs=False, browser=None, app=FakeApp.app)
def test_continuous_integration__set_browser(): with in_temp_dir(): write_config() cmd = Command(FakeApp, FakeCI) cmd.run(['ci', '--browser', 'firefox']) FakeCI.runner.run.assert_called_once_with(browser='firefox', show_logs=False, seed=None, app=FakeApp.app)
def test_standalone__missing_config(monkeypatch): with in_temp_dir(): FakeApp.app = None cmd = Command(FakeApp, FakeCI) cmd.run(['server']) assert FakeApp.app == None
def test_continuous_integration__show_logs(monkeypatch): with in_temp_dir(): write_config() cmd = Command(FakeApp, FakeCI) cmd.run(['ci', '--logs']) FakeCI.runner.run.assert_called_once_with(show_logs=True, browser=None, seed=None, app=FakeApp.app)
def test_standalone__port_default(monkeypatch): with in_temp_dir(): write_config() cmd = Command(FakeApp, FakeCI) cmd.run(['server']) FakeApp.app.run.assert_called_once_with(host="127.0.0.1", port=8888, blocking=True)
def test_standalone__port_invalid(monkeypatch): with in_temp_dir(): write_config() FakeApp.app = None cmd = Command(FakeApp, FakeCI) with pytest.raises(SystemExit): cmd.run(['server', '-p', 'pants']) assert "invalid int value: 'pants'" assert FakeApp.app == None
def test_continuous_integration__custom_config__from_argv(monkeypatch): with in_temp_dir(): write_config("custom/path/to/jasmine.yml") fake_standalone = Mock() cmd = Command(fake_standalone, FakeCI) cmd.run(['ci', '-c', 'custom/path/to/jasmine.yml']) fake_standalone.assert_called_once() standalone_construction_kwargs = fake_standalone.call_args[1] called_with_config = standalone_construction_kwargs['jasmine_config'].yaml_file assert called_with_config.endswith("custom/path/to/jasmine.yml")
def test_standalone__custom_config__from_argv(monkeypatch): with in_temp_dir(): write_config("custom/path/to/jasmine.yml") fake_standalone = Mock() cmd = Command(fake_standalone, FakeCI) cmd.run(['server', "-c", "custom/path/to/jasmine.yml"]) fake_standalone.assert_called_once() standalone_construction_kwargs = fake_standalone.call_args[1] called_with_config = standalone_construction_kwargs[ 'jasmine_config'].yaml_file assert called_with_config.endswith("custom/path/to/jasmine.yml")
def test_standalone__custom_config__when_environment_variable_set(monkeypatch): with in_temp_dir(): write_config("custom/path/to/jasmine.yml") env_vars = {'JASMINE_CONFIG_PATH': "custom/path/to/jasmine.yml"} monkeypatch.setattr(os, 'environ', env_vars) fake_standalone = Mock() cmd = Command(fake_standalone, FakeCI) cmd.run(['server']) fake_standalone.assert_called_once() standalone_construction_kwargs = fake_standalone.call_args[1] called_with_config = standalone_construction_kwargs['jasmine_config'].yaml_file assert called_with_config.endswith("custom/path/to/jasmine.yml")
def test_standalone__custom_config__when_environment_variable_set(monkeypatch): with in_temp_dir(): write_config("custom/path/to/jasmine.yml") env_vars = {'JASMINE_CONFIG_PATH': "custom/path/to/jasmine.yml"} monkeypatch.setattr(os, 'environ', env_vars) fake_standalone = Mock() cmd = Command(fake_standalone, FakeCI) cmd.run(['server']) fake_standalone.assert_called_once() standalone_construction_kwargs = fake_standalone.call_args[1] called_with_config = standalone_construction_kwargs[ 'jasmine_config'].yaml_file assert called_with_config.endswith("custom/path/to/jasmine.yml")
def test_ci_config_check(): with in_temp_dir(): FakeCI.runner = None cmd = Command(FakeApp, FakeCI) cmd.run(['ci']) assert FakeCI.runner == None
def test_init__run(monkeypatch): with in_temp_dir(): cmd = Command(FakeApp, FakeCI) input_string(monkeypatch, "N") cmd.run(['init'])