def _return_mocks(since=None): commit = Mock() commit.author.id = 4 commit.author.login = '******' commit.additions = 2 commit.deletions = 3 return [commit]
def test_increment_counters(self): progress = CommonProgressModel() self.assertEqual(progress.commit_count, 0) self.assertEqual(progress.additions_count, 0) self.assertEqual(progress.deletions_count, 0) commit = Mock() commit.additions = 2 commit.deletions = 3 progress.increment_counters(commit) self.assertEqual(progress.commit_count, 1) self.assertEqual(progress.additions_count, 2) self.assertEqual(progress.deletions_count, 3)
def test_create_from_real_commit(self): author = CommitAuthor.objects.create( author_id=99, login='******') project = Project.objects.create( user_id=1, name='1', repo_url='http://google.com') self.assertEqual(Commit.objects.count(), 0) commit = Mock() commit.sha = '12312312312313' commit.additions = 0 commit.deletions = 0 commit.last_modified = now() Commit.objects.create_from_real_commit(commit, author, project) self.assertEqual(Commit.objects.count(), 1) Commit.objects.create_from_real_commit(commit, author, project) self.assertEqual(Commit.objects.count(), 1)