Skip to content

Commit

Permalink
Write test for commits_to_repo (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlacomis committed Dec 6, 2017
1 parent f629f00 commit feb41fe
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/project_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ def test_files_in_commit(self):
'ruby/tests/gc_test.rb']))


def test_commits_to_repo(self):
def check_one(project, expected, after = None, before = None):
self.assertEqual(project.commits_to_repo(after=after,
before=before), expected)

project = Project.from_url('https://github.com/squaresLab/blameandshame-test-repo')
check_one(project, ['e1d2532', '71622b3', '9ca70f7', '2282c66'],
after = '2282c66', before = 'e1d2532')
# Starting from first commit
check_one(project, ['922e13d', '422cab3', '964adc5'],
after = '964adc5', before = '922e13d')
# after == before
check_one(project, ['2282c66'],
after = '2282c66', before = '2282c66')

def test_commits_to_file(self):
def check_one(project, filename, expected):
expected = [project.repo.commit(sha) for sha in expected]
Expand Down

0 comments on commit feb41fe

Please sign in to comment.