Пример #1
0
def test_get_projectversion_no_cfg():
    """
    Test get_projectversion if config dict is empty
    """
    path = Path("/foo/bar")
    result = get_projectversion(path)
    assert result == ""
Пример #2
0
def test_get_projectversion_no_cfg():
    """
    Test get_projectversion if config dict is empty
    """
    path = Path("/foo/bar")
    with patch("molior.molior.core.logger"):
        result = get_projectversion(path)
        assert result == ""
Пример #3
0
def test_get_projectversion_tgt_set():
    """
    Test get_projectversion if no cfg version is set and a valid target_repo_version is set
    """
    with patch("molior.molior.core.Configuration") as mock:
        cfg = MagicMock()
        cfg.config_version = None
        cfg.target_repo_version = "foo-next"
        mock.return_value = cfg

        path = Path("/foo/bar")
        setattr(path.__class__, "exists", MagicMock(return_value=True))
        result = get_projectversion(path)
        assert result == "foo-next"
Пример #4
0
def test_get_projectversion_v_set():
    """
    Test get_projectversion if a cfg version is set
    """
    with patch("molior.molior.core.Configuration") as mock:

        cfg = MagicMock()
        cfg.config_version = "1"
        mock.return_value = cfg

        path = Path("/foo/bar")
        setattr(path.__class__, "exists", MagicMock(return_value=True))
        result = get_projectversion(path)
        assert result == ""