import pytest

from checkmate.lib.frontends.git import GitProject
import checkmate.tests.settings as settings

from checkmate.tests.lib.git.test_repository import test_repository_directory

@pytest.fixture(scope = "function")
def project(request,test_repository_directory):
    return GitProject({'path' : test_repository_directory})

def test_snapshots(project):
    snapshots = project.get_snapshots(branch = "master")

    assert len(snapshots) == 157

    assert snapshots[0].project == project

def test_file_revisions(project):
    snapshot = project.get_snapshots()[0]
    file_revisions = snapshot.get_file_revisions()
    assert len(file_revisions) == 37
    assert 'd3py/HTTPHandler.py' in [f.path for f in file_revisions]

    assert file_revisions[0].snapshot == snapshot