diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-07-30 21:39:13 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-07-30 21:39:13 +0300 |
commit | ce4b199fe472c23f37376fc2e30e946c93bd4952 (patch) | |
tree | ada8ee10ace169e86ab6477307ea0aa8de3d95e4 /test/test_github.py | |
parent | v1.1.1 (diff) | |
download | cgitize-ce4b199fe472c23f37376fc2e30e946c93bd4952.tar.gz cgitize-ce4b199fe472c23f37376fc2e30e946c93bd4952.zip |
add some unit tests
This is a first step towards integrating with GitHub/Bitbucket properly.
Diffstat (limited to 'test/test_github.py')
-rw-r--r-- | test/test_github.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_github.py b/test/test_github.py new file mode 100644 index 0000000..ab96ecc --- /dev/null +++ b/test/test_github.py @@ -0,0 +1,26 @@ +# Copyright (c) 2021 Egor Tensin <Egor.Tensin@gmail.com> +# This file is part of the "cgitize" project. +# For details, see https://github.com/egor-tensin/cgitize. +# Distributed under the MIT License. + +import unittest + +from github import Github, GithubException + + +class GitHubTests(unittest.TestCase): + def setUp(self): + self.github = Github() + + def test_nonexistent_repo(self): + with self.assertRaises(GithubException): + self.github.get_repo('doesnot/exist') + + def test_existing_repo(self): + r = self.github.get_repo('egor-tensin/cgitize-test-repository') + self.assertEqual(r.name, 'cgitize-test-repository') + self.assertEqual(r.description, 'Test cgitize repository') + self.assertEqual(r.clone_url, 'https://github.com/egor-tensin/cgitize-test-repository.git') + self.assertEqual(r.ssh_url, 'git@github.com:egor-tensin/cgitize-test-repository.git') + self.assertEqual(r.owner.name, 'Egor Tensin') + self.assertEqual(r.owner.login, 'egor-tensin') |