Esempio n. 1
0
    def test_catch_None(self):
        self.response('', 200)
        self.get(self.api_url)
        self.conf = {'params': None, 'headers': {}}

        with expect.raises(StopIteration):
            next(self.i)

        self.mock_assertions()
Esempio n. 2
0
    def test_catch_None(self):
        self.response('', 200)
        self.get(self.api_url)
        self.conf = {'params': None, 'headers': {}}

        with expect.raises(StopIteration):
            next(self.i)

        self.mock_assertions()
Esempio n. 3
0
    def test_count_reaches_0(self):
        self.response('user', _iter=True)
        self.get(self.api_url)
        self.conf = {'params': None, 'headers': {}}
        self.i = GitHubIterator(1, self.api_url, github3.users.User, self.g)

        expect(next(self.i)).isinstance(github3.users.User)
        with expect.raises(StopIteration):
            next(self.i)

        self.mock_assertions()
Esempio n. 4
0
    def test_entire_while_loop(self):
        self.response('user', _iter=True)
        self.get(self.api_url)
        self.conf = {'params': None, 'headers': {}}

        expect(next(self.i)).isinstance(github3.users.User)

        with expect.raises(StopIteration):
            next(self.i)

        self.mock_assertions()
Esempio n. 5
0
    def test_iter_statuses(self):
        self.response('status', _iter=True)
        self.get(self.api + 'statuses/fakesha')

        with expect.raises(StopIteration):
            next(self.repo.iter_statuses(None))
            self.not_called()

        s = next(self.repo.iter_statuses('fakesha'))
        expect(s).isinstance(github3.repos.Status)
        self.mock_assertions()
Esempio n. 6
0
    def test_iter_org_events(self):
        self.response('event', 200, _iter=True)
        self.get(self.api + '/events/orgs/foo')

        with expect.raises(StopIteration):
            next(self.user.iter_org_events(None))

        self.not_called()
        expect(next(self.user.iter_org_events('foo'))).isinstance(
            github3.events.Event)
        self.mock_assertions()
Esempio n. 7
0
    def test_count_reaches_0(self):
        self.response('user', _iter=True)
        self.get(self.api_url)
        self.conf = {'params': None, 'headers': {}}
        self.i = GitHubIterator(1, self.api_url, github3.users.User, self.g)

        expect(next(self.i)).isinstance(github3.users.User)
        with expect.raises(StopIteration):
            next(self.i)

        self.mock_assertions()
Esempio n. 8
0
    def test_entire_while_loop(self):
        self.response('user', _iter=True)
        self.get(self.api_url)
        self.conf = {'params': None, 'headers': {}}

        expect(next(self.i)).isinstance(github3.users.User)

        with expect.raises(StopIteration):
            next(self.i)

        self.mock_assertions()
Esempio n. 9
0
    def test_iter_statuses(self):
        self.response('status', _iter=True)
        self.get(self.api + 'statuses/fakesha')

        with expect.raises(StopIteration):
            next(self.repo.iter_statuses(None))
            self.not_called()

        s = next(self.repo.iter_statuses('fakesha'))
        expect(s).isinstance(repos.status.Status)
        self.mock_assertions()
Esempio n. 10
0
    def test_iter_org_events(self):
        self.response('event', 200, _iter=True)
        self.get(self.api + '/events/orgs/foo')

        with expect.raises(StopIteration):
            next(self.user.iter_org_events(None))

        self.not_called()
        expect(next(self.user.iter_org_events('foo'))).isinstance(
            github3.events.Event)
        self.mock_assertions()
Esempio n. 11
0
    def test_iter_repo_issues(self):
        self.response('issue', _iter=True)
        self.get('https://api.github.com/repos/sigmavirus24/github3.py/'
                 'issues')

        with patch.object(github3.GitHub, 'repository') as repo:
            repo.return_value = github3.repos.Repository(load('repo'), self.g)
            i = next(self.g.iter_repo_issues('sigmavirus24', 'github3.py'))

        expect(i).isinstance(github3.issues.Issue)
        self.mock_assertions()

        with expect.raises(StopIteration):
            next(self.g.iter_repo_issues(None, None))
Esempio n. 12
0
    def test_iter_repo_issues(self):
        self.response('issue', _iter=True)
        self.get('https://api.github.com/repos/sigmavirus24/github3.py/'
                 'issues')

        with patch.object(github3.GitHub, 'repository') as repo:
            repo.return_value = github3.repos.Repository(load('repo'),
                                                         self.g)
            i = next(self.g.iter_repo_issues('sigmavirus24', 'github3.py'))

        expect(i).isinstance(github3.issues.Issue)
        self.mock_assertions()

        with expect.raises(StopIteration):
            next(self.g.iter_repo_issues(None, None))
Esempio n. 13
0
 def test_iter_forks(self):
     with expect.raises(StopIteration):
         expect(next(self.gist.iter_forks()))
Esempio n. 14
0
 def test_iter_forks(self):
     with expect.raises(StopIteration):
         expect(next(self.gist.iter_forks()))