def test_check_passes_when_docker_present(self):
        dcr = flexmock(DockerCommandRunner)
        dcr.should_receive('_docker_module').and_return(object())
        dcr.should_receive('_docker_group_active').and_return(True)
        dcr.should_receive('_docker_service_running').and_return(True)
        dcr.should_call('_docker_group_add').never()
        dcr.should_call('_docker_service_enable_and_run').never()

        DockerCommandRunner._docker_check_setup()
    def test_check_passes_when_docker_present(self):
        dh = flexmock(DockerHelper)
        dh.should_receive('_docker_module').and_return(object())
        print(DockerHelper._docker_module, DockerHelper.is_available())
        dh.should_receive('docker_group_active').and_return(True)
        dh.should_receive('docker_service_running').and_return(True)
        dh.should_call('add_user_to_docker_group').never()
        dh.should_call('docker_service_enable_and_run').never()

        DockerCommandRunner._docker_check_setup()
    def test_check_fails_when_docker_py_not_present(self):
        dh = flexmock(DockerHelper)
        dh.should_receive('_docker_module').and_return(None)
        dh.should_call('add_user_to_docker_group').never()
        dh.should_call('docker_service_enable_and_run').never()

        with pytest.raises(CommandException) as excinfo:
            DockerCommandRunner._docker_check_setup()

        assert 'module is not present' in str(excinfo.value)
Ejemplo n.º 4
0
    def test_check_passes_when_docker_present(self):
        dh = flexmock(DockerHelper)
        dh.should_receive('_docker_module').and_return(object())
        print(DockerHelper._docker_module, DockerHelper.is_available())
        dh.should_receive('docker_group_active').and_return(True)
        dh.should_receive('docker_service_running').and_return(True)
        dh.should_call('add_user_to_docker_group').never()
        dh.should_call('docker_service_enable_and_run').never()

        DockerCommandRunner._docker_check_setup()
Ejemplo n.º 5
0
    def test_check_fails_when_docker_py_not_present(self):
        dh = flexmock(DockerHelper)
        dh.should_receive('_docker_module').and_return(None)
        dh.should_call('add_user_to_docker_group').never()
        dh.should_call('docker_service_enable_and_run').never()

        with pytest.raises(CommandException) as excinfo:
            DockerCommandRunner._docker_check_setup()

        assert 'module is not present' in str(excinfo.value)