예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
def test_standalone__missing_config(monkeypatch):
    with in_temp_dir():
        FakeApp.app = None
        cmd = Command(FakeApp, FakeCI)
        cmd.run(['server'])

        assert FakeApp.app == None
예제 #4
0
def test_standalone__missing_config(monkeypatch):
    with in_temp_dir():
        FakeApp.app = None
        cmd = Command(FakeApp, FakeCI)
        cmd.run(['server'])

        assert FakeApp.app == None
예제 #5
0
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)
예제 #6
0
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)
예제 #7
0
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)
예제 #8
0
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)
예제 #9
0
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)
예제 #10
0
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)
예제 #11
0
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
예제 #12
0
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
예제 #13
0
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")
예제 #14
0
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")
예제 #15
0
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")
예제 #16
0
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")
예제 #17
0
def test_ci_config_check():
    with in_temp_dir():
        FakeCI.runner = None
        cmd = Command(FakeApp, FakeCI)
        cmd.run(['ci'])
        assert FakeCI.runner == None
예제 #18
0
def test_init__run(monkeypatch):
    with in_temp_dir():
        cmd = Command(FakeApp, FakeCI)
        input_string(monkeypatch, "N")

        cmd.run(['init'])
예제 #19
0
def test_init__run(monkeypatch):
    with in_temp_dir():
        cmd = Command(FakeApp, FakeCI)
        input_string(monkeypatch, "N")

        cmd.run(['init'])
예제 #20
0
def test_ci_config_check():
    with in_temp_dir():
        FakeCI.runner = None
        cmd = Command(FakeApp, FakeCI)
        cmd.run(['ci'])
        assert FakeCI.runner == None