Exemplo n.º 1
0
class TestGitHubRequest(unittest.TestCase):
    def setUp(self):
        self.github_request_class = GitHubRequest(
            force=True,
            token=os.environ['GITHUB_TOKEN'],
            repo_url='https://github.com/akshaybabloo/release-exporter')

    def test_total_number_releases(self):
        response = self.github_request_class._total_number_releases()

        self.assertIsInstance(response, int)

    def test_release(self):
        response = self.github_request_class.releases()
        self.assertIn('tag', json.dumps(response))
Exemplo n.º 2
0
def test_GitHubRequest_fail_2():
    with pytest.raises(
            InvalidToken,
            message=
            "Oops! GitHub requires you to generate a private token to get the details. See "
            "https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ "
            "for more information."):
        a = GitHubRequest(force=True)
Exemplo n.º 3
0
class TestGitHubRequestFail(unittest.TestCase):
    def setUp(self):
        self.github_request_class = GitHubRequest(force=True, token='hello')

    def test_total_number_releases(self):
        with pytest.raises(
                KeyError,
                message=
                'Wrong credentials given. Please check if you have the correct token.'
        ):
            response = self.github_request_class._total_number_releases()

    def test_releases(self):
        with pytest.raises(
                KeyError,
                message=
                'Wrong credentials given. Please check if you have the correct token.'
        ):
            response = self.github_request_class.releases()
Exemplo n.º 4
0
 def setUp(self):
     self.github_request_class = GitHubRequest(
         force=True,
         token=os.environ['GITHUB_TOKEN'],
         repo_url='https://github.com/akshaybabloo/release-exporter')
Exemplo n.º 5
0
 def setUp(self):
     self.github_request_class = GitHubRequest(force=True, token='hello')
Exemplo n.º 6
0
 def test_init_condition(self):
     local_car = GitHubRequest(
         force=True,
         token='hello',
         repo_url='https://github.com/akshaybabloo/release-exporter')
     self.assertEqual(local_car.info.name, 'release-exporter')
Exemplo n.º 7
0
def test_GitHubRequest_fail():
    with pytest.raises(FileExists,
                       message='CHANGELOG.md already exists at ' +
                       os.getcwd() + '. Use --force to override.'):
        a = GitHubRequest()