Skip to content

Commit 4055c31

Browse files
committed
not sure how to write this test
1 parent 7fa4107 commit 4055c31

2 files changed

Lines changed: 29 additions & 2 deletions

File tree

github3/users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def received_events(self, public=False, number=-1, etag=None):
349349
url = self._build_url(*path, base_url=self._api)
350350
return self._iter(int(number), url, Event, etag=etag)
351351

352-
def organization(self, number=-1, etag=None):
352+
def orgs(self, number=-1, etag=None):
353353
"""Iterate over organizations the user is member of
354354
355355
:param int number: (optional), number of organizations to return.

tests/unit/test_users.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
import pytest
22

3+
import github3
4+
35
from github3 import GitHubError
46
from github3.users import User
57

6-
from .helper import UnitHelper, UnitIteratorHelper, create_url_helper
8+
from .helper import (UnitHelper, UnitIteratorHelper, create_url_helper,
9+
create_example_data_helper)
10+
11+
url_for = create_url_helper(
12+
'https://api.github.com/users/esacteksab'
13+
)
14+
15+
get_user_example_data = create_example_data_helper('user_example_data')
16+
17+
18+
class TestUserIterators(UnitIteratorHelper):
19+
20+
"""Test User methods that return iterators."""
21+
22+
described_class = github3.users.User
23+
24+
def test_followers(self):
25+
"""Test the request to retrieve follwers."""
26+
f = self.instance.followers()
27+
self.get_next(f)
28+
29+
self.session.get.assert_called_once_with(
30+
url_for('followers'),
31+
params={'per_page': 100},
32+
headers={}
33+
)

0 commit comments

Comments
 (0)