def test_tag_contributors(self, mock_fetch): with patch("pygit2.Mailmap"): v2_tag = GitTags(MagicMock()).get('v2') self.assertDictEqual({ 'Author1': 2, 'Author2': 1 }, v2_tag.contributors['commits_count'].to_dict())
def test_tag_tagger(self, mock_fetch): with patch("pygit2.Mailmap"): tags = GitTags(MagicMock()).all() unreleased_tag = next(tags) self.assertIsNone(unreleased_tag.tagger) v2_tag = next(tags) self.assertEqual("Release Master", v2_tag.tagger)
def test_tag_timings(self, mock_fetch): with patch("pygit2.Mailmap"): v2_tag = GitTags(MagicMock()).get('v2') self.assertEqual( datetime.datetime.utcfromtimestamp(1234).replace( tzinfo=datetime.timezone.utc), v2_tag.created) self.assertEqual( datetime.datetime.utcfromtimestamp(14).replace( tzinfo=datetime.timezone.utc), v2_tag.initiated)
def test_unreleased_tag_accessible(self, mock_fetch): with patch("pygit2.Mailmap"): tags = GitTags(MagicMock()).all() unreleased_tag = next(tags) self.assertEqual('unreleased', str(unreleased_tag))
def test_tag_commits_count(self, mock_fetch): with patch("pygit2.Mailmap"): v2_tag = GitTags(MagicMock()).get('v2') self.assertEqual(3, v2_tag.commits_count)
def test_tags_all(self, mock_fetch): with patch("pygit2.Mailmap"): tags = GitTags(MagicMock()).all() self.assertEqual(2, len(list(tags)))
def test_repo_with_no_tags(self, mock_fetch): with patch("pygit2.Mailmap"): tags = GitTags(MagicMock()).all() unreleased_tag = next(tags) self.assertIsNone(unreleased_tag.tagger) self.assertIsNone(unreleased_tag.created)