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
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()