Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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")
Ejemplo n.º 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
Ejemplo n.º 18
0
def test_init__run(monkeypatch):
    with in_temp_dir():
        cmd = Command(FakeApp, FakeCI)
        input_string(monkeypatch, "N")

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

        cmd.run(['init'])
Ejemplo n.º 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