def test_invalid_token(self): """ Test invalid GitHub personal access token. """ with self.assertRaises(ghstats.GithubTokenError): ghstats.download_stats("kefir500", "foobar", None, False, "FOOBAR", True)
def test_invalid_repo(self): """ Test nonexistent repository. """ with self.assertRaises(ghstats.GithubRepoError): ghstats.download_stats("kefir500", "foobar", None, False, ghstats.get_env_token(), True)
def test_release(self): """ Test statistics for the latest release. """ stats = ghstats.download_stats("kefir500", "apk-icon-editor", None, True, ghstats.get_env_token(), False) self.assertTrue(isinstance(stats, dict)) count = ghstats.get_stats_downloads(stats, False) self.assertTrue(count > 0)
def test_unicode(self): """ Test Unicode handling. """ release = ghstats.download_stats("d3", "d3", "v3.5.0", False, ghstats.get_env_token(), False) try: ghstats.get_release_downloads(release) except UnicodeEncodeError: self.fail("Could not handle Unicode release statistics.")