|
| 1 | +"""Unit tests for the Milestone class.""" |
| 2 | +import github3 |
| 3 | + |
| 4 | +from .helper import (UnitIteratorHelper, create_url_helper,) |
| 5 | + |
| 6 | +example_data = { |
| 7 | + "url": "https://api.github.com/repos/octocat/Hello-World/milestones/1", |
| 8 | + "number": 1, |
| 9 | + "state": "open", |
| 10 | + "title": "v1.0", |
| 11 | + "description": "", |
| 12 | + "creator": { |
| 13 | + "login": "octocat", |
| 14 | + "id": 1, |
| 15 | + "avatar_url": "https://github.com/images/error/octocat_happy.gif", |
| 16 | + "gravatar_id": "somehexcode", |
| 17 | + "url": "https://api.github.com/users/octocat", |
| 18 | + "html_url": "https://github.com/octocat", |
| 19 | + "followers_url": "https://api.github.com/users/octocat/followers", |
| 20 | + "following_url": ("https://api.github.com/users/octocat/following" |
| 21 | + "{/other_user}"), |
| 22 | + "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", |
| 23 | + "starred_url": ("https://api.github.com/users/octocat/starred" |
| 24 | + "{/owner}{/repo}"), |
| 25 | + "subscriptions_url": ("https://api.github.com/users/octocat/" |
| 26 | + "subscriptions"), |
| 27 | + "organizations_url": "https://api.github.com/users/octocat/orgs", |
| 28 | + "repos_url": "https://api.github.com/users/octocat/r
8000
epos", |
| 29 | + "events_url": "https://api.github.com/users/octocat/events{/privacy}", |
| 30 | + "received_events_url": ("https://api.github.com/users/octocat/" |
| 31 | + "received_events"), |
| 32 | + "type": "User", |
| 33 | + "site_admin": False |
| 34 | + }, |
| 35 | + "open_issues": 4, |
| 36 | + "closed_issues": 8, |
| 37 | + "created_at": "2011-04-10T20:09:31Z", |
| 38 | + "updated_at": "2014-03-03T18:58:10Z", |
| 39 | + "due_on": None |
| 40 | +} |
| 41 | + |
| 42 | +url_for = create_url_helper("https://api.github.com/repos/octocat/Hello-World/" |
| 43 | + "milestones/1") |
| 44 | + |
| 45 | + |
| 46 | +class TestMilestoneIterator(UnitIteratorHelper): |
| 47 | + |
| 48 | + """Test Milestone methods that return iterators.""" |
| 49 | + |
| 50 | + described_class = github3.issues.milestone.Milestone |
| 51 | + example_data = example_data |
| 52 | + |
| 53 | + def test_labels(self): |
| 54 | + """Test the request to retrieve labels associated with a milestone.""" |
| 55 | + i = self.instance.labels() |
| 56 | + self.get_next(i) |
| 57 | + |
| 58 | + self.session.get.assert_called_once_with( |
| 59 | + url_for('labels'), |
| 60 | + params={'per_page': 100}, |
| 61 | + headers={} |
| 62 | + ) |
0 commit comments