def test_git_version(monkeypatch, mocker, sample_metadata, branch_name):
    monkeypatch.setenv('TRAVIS', 'false')
    import documenteer.designdocs.ddconfig
    documenteer.designdocs.ddconfig.read_git_branch = mocker.MagicMock()
    documenteer.designdocs.ddconfig.read_git_branch.return_value = branch_name

    sample_metadata.pop('version')

    config = _build_confs(sample_metadata)

    assert config['version'] == branch_name
def test_git_last_revised(monkeypatch, mocker, sample_metadata,
                          input, expected):
    monkeypatch.setenv('TRAVIS', 'false')
    import documenteer.designdocs.ddconfig
    documenteer.designdocs.ddconfig.read_git_commit_timestamp \
        = mocker.MagicMock()
    documenteer.designdocs.ddconfig.read_git_commit_timestamp.return_value \
        = input

    sample_metadata.pop('last_revised')

    config = _build_confs(sample_metadata)

    assert config['today'] == expected
    assert config['html_context']['last_revised'] == expected
def test_hard_coded_last_revised(monkeypatch, sample_metadata):
    monkeypatch.setenv('TRAVIS', 'false')
    config = _build_confs(sample_metadata)
    assert config['html_context']['last_revised'] \
        == sample_metadata['last_revised']
def test_hard_coded_version(monkeypatch, sample_metadata):
    monkeypatch.setenv('TRAVIS', 'false')
    config = _build_confs(sample_metadata)
    assert config['version'] == sample_metadata['version']