Last active
August 29, 2015 14:05
-
-
Save Ivaylo-Bachvarov/20b75205f7a7f7b99ead to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from mock import patch | |
from github import Github, GithubException | |
def is_valid_repo(Github, user_name, repo_name): | |
github_client = Github("TOKEN_HERE") | |
try: | |
api_user = github_client.get_user(user_name) | |
api_repo = api_user.get_repo(repo_name) | |
return True | |
except GithubException: | |
return False | |
class Test(unittest.TestCase): | |
def test_is_valid_repo(self): | |
user_name = 'Ivaylo-Bachvarov' | |
repo_name = 'Telerik-Courses' | |
self.assertEqual(is_valid_repo(Github, user_name, repo_name), True) | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment