mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Use Etag in GitHub coordinator updates (#64449)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
1ffc2a05db
commit
e272ab7a29
@ -7,8 +7,10 @@ from aiogithubapi import (
|
|||||||
GitHubAPI,
|
GitHubAPI,
|
||||||
GitHubCommitModel,
|
GitHubCommitModel,
|
||||||
GitHubException,
|
GitHubException,
|
||||||
|
GitHubNotModifiedException,
|
||||||
GitHubReleaseModel,
|
GitHubReleaseModel,
|
||||||
GitHubRepositoryModel,
|
GitHubRepositoryModel,
|
||||||
|
GitHubResponseModel,
|
||||||
)
|
)
|
||||||
|
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
@ -34,6 +36,7 @@ class GitHubBaseDataUpdateCoordinator(DataUpdateCoordinator[T]):
|
|||||||
self.config_entry = entry
|
self.config_entry = entry
|
||||||
self.repository = repository
|
self.repository = repository
|
||||||
self._client = client
|
self._client = client
|
||||||
|
self._last_response: GitHubResponseModel[T] | None = None
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
@ -42,15 +45,36 @@ class GitHubBaseDataUpdateCoordinator(DataUpdateCoordinator[T]):
|
|||||||
update_interval=DEFAULT_UPDATE_INTERVAL,
|
update_interval=DEFAULT_UPDATE_INTERVAL,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def fetch_data(self) -> T:
|
@property
|
||||||
|
def _etag(self) -> str:
|
||||||
|
"""Return the ETag of the last response."""
|
||||||
|
return self._last_response.etag if self._last_response is not None else None
|
||||||
|
|
||||||
|
async def fetch_data(self) -> GitHubResponseModel[T]:
|
||||||
"""Fetch data from GitHub API."""
|
"""Fetch data from GitHub API."""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse_response(response: GitHubResponseModel[T]) -> T:
|
||||||
|
"""Parse the response from GitHub API."""
|
||||||
|
return response.data
|
||||||
|
|
||||||
async def _async_update_data(self) -> T:
|
async def _async_update_data(self) -> T:
|
||||||
try:
|
try:
|
||||||
return await self.fetch_data()
|
response = await self.fetch_data()
|
||||||
|
except GitHubNotModifiedException:
|
||||||
|
LOGGER.debug(
|
||||||
|
"Content for %s with %s not modified",
|
||||||
|
self.repository,
|
||||||
|
self.__class__.__name__,
|
||||||
|
)
|
||||||
|
# Return the last known data if the request result was not modified
|
||||||
|
return self.data
|
||||||
except GitHubException as exception:
|
except GitHubException as exception:
|
||||||
LOGGER.exception(exception)
|
LOGGER.exception(exception)
|
||||||
raise UpdateFailed(exception) from exception
|
raise UpdateFailed(exception) from exception
|
||||||
|
else:
|
||||||
|
self._last_response = response
|
||||||
|
return self._parse_response(response)
|
||||||
|
|
||||||
|
|
||||||
class RepositoryInformationDataUpdateCoordinator(
|
class RepositoryInformationDataUpdateCoordinator(
|
||||||
@ -58,10 +82,9 @@ class RepositoryInformationDataUpdateCoordinator(
|
|||||||
):
|
):
|
||||||
"""Data update coordinator for repository information."""
|
"""Data update coordinator for repository information."""
|
||||||
|
|
||||||
async def fetch_data(self) -> GitHubRepositoryModel:
|
async def fetch_data(self) -> GitHubResponseModel[GitHubRepositoryModel]:
|
||||||
"""Get the latest data from GitHub."""
|
"""Get the latest data from GitHub."""
|
||||||
result = await self._client.repos.get(self.repository)
|
return await self._client.repos.get(self.repository, **{"etag": self._etag})
|
||||||
return result.data
|
|
||||||
|
|
||||||
|
|
||||||
class RepositoryReleaseDataUpdateCoordinator(
|
class RepositoryReleaseDataUpdateCoordinator(
|
||||||
@ -69,20 +92,26 @@ class RepositoryReleaseDataUpdateCoordinator(
|
|||||||
):
|
):
|
||||||
"""Data update coordinator for repository release."""
|
"""Data update coordinator for repository release."""
|
||||||
|
|
||||||
async def fetch_data(self) -> GitHubReleaseModel | None:
|
@staticmethod
|
||||||
"""Get the latest data from GitHub."""
|
def _parse_response(
|
||||||
result = await self._client.repos.releases.list(
|
response: GitHubResponseModel[GitHubReleaseModel | None],
|
||||||
self.repository, **{"params": {"per_page": 1}}
|
) -> GitHubReleaseModel | None:
|
||||||
)
|
"""Parse the response from GitHub API."""
|
||||||
if not result.data:
|
if not response.data:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
for release in result.data:
|
for release in response.data:
|
||||||
if not release.prerelease:
|
if not release.prerelease:
|
||||||
return release
|
return release
|
||||||
|
|
||||||
# Fall back to the latest release if no non-prerelease release is found
|
# Fall back to the latest release if no non-prerelease release is found
|
||||||
return result.data[0]
|
return response.data[0]
|
||||||
|
|
||||||
|
async def fetch_data(self) -> GitHubReleaseModel | None:
|
||||||
|
"""Get the latest data from GitHub."""
|
||||||
|
return await self._client.repos.releases.list(
|
||||||
|
self.repository, **{"params": {"per_page": 1}, "etag": self._etag}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class RepositoryIssueDataUpdateCoordinator(
|
class RepositoryIssueDataUpdateCoordinator(
|
||||||
@ -90,32 +119,60 @@ class RepositoryIssueDataUpdateCoordinator(
|
|||||||
):
|
):
|
||||||
"""Data update coordinator for repository issues."""
|
"""Data update coordinator for repository issues."""
|
||||||
|
|
||||||
|
_issue_etag: str | None = None
|
||||||
|
_pull_etag: str | None = None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse_response(response: IssuesPulls) -> IssuesPulls:
|
||||||
|
"""Parse the response from GitHub API."""
|
||||||
|
return response
|
||||||
|
|
||||||
async def fetch_data(self) -> IssuesPulls:
|
async def fetch_data(self) -> IssuesPulls:
|
||||||
"""Get the latest data from GitHub."""
|
"""Get the latest data from GitHub."""
|
||||||
base_issue_response = await self._client.repos.issues.list(
|
pulls_count = 0
|
||||||
self.repository, **{"params": {"per_page": 1}}
|
pull_last = None
|
||||||
)
|
issues_count = 0
|
||||||
pull_response = await self._client.repos.pulls.list(
|
issue_last = None
|
||||||
self.repository, **{"params": {"per_page": 1}}
|
try:
|
||||||
)
|
pull_response = await self._client.repos.pulls.list(
|
||||||
|
self.repository,
|
||||||
|
**{"params": {"per_page": 1}, "etag": self._pull_etag},
|
||||||
|
)
|
||||||
|
except GitHubNotModifiedException:
|
||||||
|
# Return the last known data if the request result was not modified
|
||||||
|
pulls_count = self.data.pulls_count
|
||||||
|
pull_last = self.data.pull_last
|
||||||
|
else:
|
||||||
|
self._pull_etag = pull_response.etag
|
||||||
|
pulls_count = pull_response.last_page_number or 0
|
||||||
|
pull_last = pull_response.data[0] if pulls_count != 0 else None
|
||||||
|
|
||||||
pulls_count = pull_response.last_page_number or 0
|
try:
|
||||||
issues_count = (base_issue_response.last_page_number or 0) - pulls_count
|
issue_response = await self._client.repos.issues.list(
|
||||||
|
self.repository,
|
||||||
|
**{"params": {"per_page": 1}, "etag": self._issue_etag},
|
||||||
|
)
|
||||||
|
except GitHubNotModifiedException:
|
||||||
|
# Return the last known data if the request result was not modified
|
||||||
|
issues_count = self.data.issues_count
|
||||||
|
issue_last = self.data.issue_last
|
||||||
|
else:
|
||||||
|
self._issue_etag = issue_response.etag
|
||||||
|
issues_count = (issue_response.last_page_number or 0) - pulls_count
|
||||||
|
issue_last = issue_response.data[0] if issues_count != 0 else None
|
||||||
|
|
||||||
issue_last = base_issue_response.data[0] if issues_count != 0 else None
|
if issue_last is not None and issue_last.pull_request:
|
||||||
|
issue_response = await self._client.repos.issues.list(self.repository)
|
||||||
if issue_last is not None and issue_last.pull_request:
|
for issue in issue_response.data:
|
||||||
issue_response = await self._client.repos.issues.list(self.repository)
|
if not issue.pull_request:
|
||||||
for issue in issue_response.data:
|
issue_last = issue
|
||||||
if not issue.pull_request:
|
break
|
||||||
issue_last = issue
|
|
||||||
break
|
|
||||||
|
|
||||||
return IssuesPulls(
|
return IssuesPulls(
|
||||||
issues_count=issues_count,
|
issues_count=issues_count,
|
||||||
issue_last=issue_last,
|
issue_last=issue_last,
|
||||||
pulls_count=pulls_count,
|
pulls_count=pulls_count,
|
||||||
pull_last=pull_response.data[0] if pulls_count != 0 else None,
|
pull_last=pull_last,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -124,12 +181,18 @@ class RepositoryCommitDataUpdateCoordinator(
|
|||||||
):
|
):
|
||||||
"""Data update coordinator for repository commit."""
|
"""Data update coordinator for repository commit."""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _parse_response(
|
||||||
|
response: GitHubResponseModel[GitHubCommitModel | None],
|
||||||
|
) -> GitHubCommitModel | None:
|
||||||
|
"""Parse the response from GitHub API."""
|
||||||
|
return response.data[0] if response.data else None
|
||||||
|
|
||||||
async def fetch_data(self) -> GitHubCommitModel | None:
|
async def fetch_data(self) -> GitHubCommitModel | None:
|
||||||
"""Get the latest data from GitHub."""
|
"""Get the latest data from GitHub."""
|
||||||
result = await self._client.repos.list_commits(
|
return await self._client.repos.list_commits(
|
||||||
self.repository, **{"params": {"per_page": 1}}
|
self.repository, **{"params": {"per_page": 1}, "etag": self._etag}
|
||||||
)
|
)
|
||||||
return result.data[0] if result.data else None
|
|
||||||
|
|
||||||
|
|
||||||
class DataUpdateCoordinators(TypedDict):
|
class DataUpdateCoordinators(TypedDict):
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
"""Common helpers for GitHub integration tests."""
|
"""Common helpers for GitHub integration tests."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import json
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.components.github.const import CONF_REPOSITORIES
|
from homeassistant.components.github.const import CONF_REPOSITORIES, DOMAIN
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry, load_fixture
|
||||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||||
|
|
||||||
MOCK_ACCESS_TOKEN = "gho_16C7e42F292c6912E7710c838347Ae178B4a"
|
MOCK_ACCESS_TOKEN = "gho_16C7e42F292c6912E7710c838347Ae178B4a"
|
||||||
|
TEST_REPOSITORY = "octocat/Hello-World"
|
||||||
|
|
||||||
|
|
||||||
async def setup_github_integration(
|
async def setup_github_integration(
|
||||||
@ -17,19 +20,22 @@ async def setup_github_integration(
|
|||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Mock setting up the integration."""
|
"""Mock setting up the integration."""
|
||||||
repository_id = 1
|
headers = json.loads(load_fixture("base_headers.json", DOMAIN))
|
||||||
for repository in mock_config_entry.options[CONF_REPOSITORIES]:
|
for idx, repository in enumerate(mock_config_entry.options[CONF_REPOSITORIES]):
|
||||||
aioclient_mock.get(
|
aioclient_mock.get(
|
||||||
f"https://api.github.com/repos/{repository}",
|
f"https://api.github.com/repos/{repository}",
|
||||||
json={"full_name": repository, "id": repository_id},
|
json={
|
||||||
headers={"Content-Type": "application/json"},
|
**json.loads(load_fixture("repository.json", DOMAIN)),
|
||||||
|
"full_name": repository,
|
||||||
|
"id": idx,
|
||||||
|
},
|
||||||
|
headers=headers,
|
||||||
)
|
)
|
||||||
repository_id += 1
|
|
||||||
for endpoint in ("issues", "pulls", "releases", "commits"):
|
for endpoint in ("issues", "pulls", "releases", "commits"):
|
||||||
aioclient_mock.get(
|
aioclient_mock.get(
|
||||||
f"https://api.github.com/repos/{repository}/{endpoint}",
|
f"https://api.github.com/repos/{repository}/{endpoint}",
|
||||||
json=[],
|
json=json.loads(load_fixture(f"{endpoint}.json", DOMAIN)),
|
||||||
headers={"Content-Type": "application/json"},
|
headers=headers,
|
||||||
)
|
)
|
||||||
mock_config_entry.add_to_hass(hass)
|
mock_config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
|
@ -7,13 +7,14 @@ import pytest
|
|||||||
from homeassistant.components.github.const import (
|
from homeassistant.components.github.const import (
|
||||||
CONF_ACCESS_TOKEN,
|
CONF_ACCESS_TOKEN,
|
||||||
CONF_REPOSITORIES,
|
CONF_REPOSITORIES,
|
||||||
DEFAULT_REPOSITORIES,
|
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from .common import MOCK_ACCESS_TOKEN
|
from .common import MOCK_ACCESS_TOKEN, TEST_REPOSITORY, setup_github_integration
|
||||||
|
|
||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@ -23,7 +24,7 @@ def mock_config_entry() -> MockConfigEntry:
|
|||||||
title="",
|
title="",
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
data={CONF_ACCESS_TOKEN: MOCK_ACCESS_TOKEN},
|
data={CONF_ACCESS_TOKEN: MOCK_ACCESS_TOKEN},
|
||||||
options={CONF_REPOSITORIES: DEFAULT_REPOSITORIES},
|
options={CONF_REPOSITORIES: [TEST_REPOSITORY]},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -32,3 +33,14 @@ def mock_setup_entry() -> Generator[None, None, None]:
|
|||||||
"""Mock setting up a config entry."""
|
"""Mock setting up a config entry."""
|
||||||
with patch("homeassistant.components.github.async_setup_entry", return_value=True):
|
with patch("homeassistant.components.github.async_setup_entry", return_value=True):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
async def init_integration(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
mock_config_entry: MockConfigEntry,
|
||||||
|
aioclient_mock: AiohttpClientMocker,
|
||||||
|
) -> MockConfigEntry:
|
||||||
|
"""Set up the GitHub integration for testing."""
|
||||||
|
await setup_github_integration(hass, mock_config_entry, aioclient_mock)
|
||||||
|
return mock_config_entry
|
||||||
|
29
tests/components/github/fixtures/base_headers.json
Normal file
29
tests/components/github/fixtures/base_headers.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"Server": "GitHub.com",
|
||||||
|
"Date": "Mon, 1 Jan 1970 00:00:00 GMT",
|
||||||
|
"Content-Type": "application/json; charset=utf-8",
|
||||||
|
"Transfer-Encoding": "chunked",
|
||||||
|
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||||
|
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||||
|
"Etag": "W/\"1234567890abcdefghijklmnopqrstuvwxyz\"",
|
||||||
|
"X-OAuth-Scopes": "",
|
||||||
|
"X-Accepted-OAuth-Scopes": "",
|
||||||
|
"github-authentication-token-expiration": "1970-01-01 01:00:00 UTC",
|
||||||
|
"X-GitHub-Media-Type": "github.v3; param=raw; format=json",
|
||||||
|
"X-RateLimit-Limit": "5000",
|
||||||
|
"X-RateLimit-Remaining": "4999",
|
||||||
|
"X-RateLimit-Reset": "1",
|
||||||
|
"X-RateLimit-Used": "1",
|
||||||
|
"X-RateLimit-Resource": "core",
|
||||||
|
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset",
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
|
||||||
|
"X-Frame-Options": "deny",
|
||||||
|
"X-Content-Type-Options": "nosniff",
|
||||||
|
"X-XSS-Protection": "0",
|
||||||
|
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
|
||||||
|
"Content-Security-Policy": "default-src 'none'",
|
||||||
|
"Content-Encoding": "gzip",
|
||||||
|
"Permissions-Policy": "",
|
||||||
|
"X-GitHub-Request-Id": "12A3:45BC:6D7890:12EF34:5678G901"
|
||||||
|
}
|
80
tests/components/github/fixtures/commits.json
Normal file
80
tests/components/github/fixtures/commits.json
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||||
|
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||||
|
"node_id": "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==",
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||||
|
"comments_url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments",
|
||||||
|
"commit": {
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||||
|
"author": {
|
||||||
|
"name": "Monalisa Octocat",
|
||||||
|
"email": "support@github.com",
|
||||||
|
"date": "2011-04-14T16:00:49Z"
|
||||||
|
},
|
||||||
|
"committer": {
|
||||||
|
"name": "Monalisa Octocat",
|
||||||
|
"email": "support@github.com",
|
||||||
|
"date": "2011-04-14T16:00:49Z"
|
||||||
|
},
|
||||||
|
"message": "Fix all the bugs",
|
||||||
|
"tree": {
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||||
|
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
|
||||||
|
},
|
||||||
|
"comment_count": 0,
|
||||||
|
"verification": {
|
||||||
|
"verified": false,
|
||||||
|
"reason": "unsigned",
|
||||||
|
"signature": null,
|
||||||
|
"payload": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"committer": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"parents": [
|
||||||
|
{
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||||
|
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
159
tests/components/github/fixtures/issues.json
Normal file
159
tests/components/github/fixtures/issues.json
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDU6SXNzdWUx",
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
|
||||||
|
"repository_url": "https://api.github.com/repos/octocat/Hello-World",
|
||||||
|
"labels_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/labels{/name}",
|
||||||
|
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
|
||||||
|
"events_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/events",
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World/issues/1347",
|
||||||
|
"number": 1347,
|
||||||
|
"state": "open",
|
||||||
|
"title": "Found a bug",
|
||||||
|
"body": "I'm having a problem with this.",
|
||||||
|
"user": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"labels": [
|
||||||
|
{
|
||||||
|
"id": 208045946,
|
||||||
|
"node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
|
||||||
|
"name": "bug",
|
||||||
|
"description": "Something isn't working",
|
||||||
|
"color": "f29513",
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"assignee": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"assignees": [
|
||||||
|
{
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"milestone": {
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
|
||||||
|
"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
|
||||||
|
"id": 1002604,
|
||||||
|
"node_id": "MDk6TWlsZXN0b25lMTAwMjYwNA==",
|
||||||
|
"number": 1,
|
||||||
|
"state": "open",
|
||||||
|
"title": "v1.0",
|
||||||
|
"description": "Tracking milestone for version 1.0",
|
||||||
|
"creator": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"open_issues": 4,
|
||||||
|
"closed_issues": 8,
|
||||||
|
"created_at": "2011-04-10T20:09:31Z",
|
||||||
|
"updated_at": "2014-03-03T18:58:10Z",
|
||||||
|
"closed_at": "2013-02-12T13:22:01Z",
|
||||||
|
"due_on": "2012-10-09T23:39:01Z"
|
||||||
|
},
|
||||||
|
"locked": true,
|
||||||
|
"active_lock_reason": "too heated",
|
||||||
|
"comments": 0,
|
||||||
|
"pull_request": {
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
|
||||||
|
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
|
||||||
|
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch"
|
||||||
|
},
|
||||||
|
"closed_at": null,
|
||||||
|
"created_at": "2011-04-22T13:33:48Z",
|
||||||
|
"updated_at": "2011-04-22T13:33:48Z",
|
||||||
|
"closed_by": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"author_association": "COLLABORATOR"
|
||||||
|
}
|
||||||
|
]
|
520
tests/components/github/fixtures/pulls.json
Normal file
520
tests/components/github/fixtures/pulls.json
Normal file
@ -0,0 +1,520 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDExOlB1bGxSZXF1ZXN0MQ==",
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World/pull/1347",
|
||||||
|
"diff_url": "https://github.com/octocat/Hello-World/pull/1347.diff",
|
||||||
|
"patch_url": "https://github.com/octocat/Hello-World/pull/1347.patch",
|
||||||
|
"issue_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347",
|
||||||
|
"commits_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits",
|
||||||
|
"review_comments_url": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments",
|
||||||
|
"review_comment_url": "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}",
|
||||||
|
"comments_url": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments",
|
||||||
|
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||||
|
"number": 1347,
|
||||||
|
"state": "open",
|
||||||
|
"locked": true,
|
||||||
|
"title": "Amazing new feature",
|
||||||
|
"user": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"body": "Please pull these awesome changes in!",
|
||||||
|
"labels": [
|
||||||
|
{
|
||||||
|
"id": 208045946,
|
||||||
|
"node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
|
||||||
|
"name": "bug",
|
||||||
|
"description": "Something isn't working",
|
||||||
|
"color": "f29513",
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"milestone": {
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/milestones/1",
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World/milestones/v1.0",
|
||||||
|
"labels_url": "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels",
|
||||||
|
"id": 1002604,
|
||||||
|
"node_id": "MDk6TWlsZXN0b25lMTAwMjYwNA==",
|
||||||
|
"number": 1,
|
||||||
|
"state": "open",
|
||||||
|
"title": "v1.0",
|
||||||
|
"description": "Tracking milestone for version 1.0",
|
||||||
|
"creator": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"open_issues": 4,
|
||||||
|
"closed_issues": 8,
|
||||||
|
"created_at": "2011-04-10T20:09:31Z",
|
||||||
|
"updated_at": "2014-03-03T18:58:10Z",
|
||||||
|
"closed_at": "2013-02-12T13:22:01Z",
|
||||||
|
"due_on": "2012-10-09T23:39:01Z"
|
||||||
|
},
|
||||||
|
"active_lock_reason": "too heated",
|
||||||
|
"created_at": "2011-01-26T19:01:12Z",
|
||||||
|
"updated_at": "2011-01-26T19:01:12Z",
|
||||||
|
"closed_at": "2011-01-26T19:01:12Z",
|
||||||
|
"merged_at": "2011-01-26T19:01:12Z",
|
||||||
|
"merge_commit_sha": "e5bd3914e2e596debea16f433f57875b5b90bcd6",
|
||||||
|
"assignee": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"assignees": [
|
||||||
|
{
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"login": "hubot",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/hubot_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/hubot",
|
||||||
|
"html_url": "https://github.com/hubot",
|
||||||
|
"followers_url": "https://api.github.com/users/hubot/followers",
|
||||||
|
"following_url": "https://api.github.com/users/hubot/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/hubot/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/hubot/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/hubot/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/hubot/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/hubot/repos",
|
||||||
|
"events_url": "https://api.github.com/users/hubot/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/hubot/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requested_reviewers": [
|
||||||
|
{
|
||||||
|
"login": "other_user",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/other_user_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/other_user",
|
||||||
|
"html_url": "https://github.com/other_user",
|
||||||
|
"followers_url": "https://api.github.com/users/other_user/followers",
|
||||||
|
"following_url": "https://api.github.com/users/other_user/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/other_user/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/other_user/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/other_user/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/other_user/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/other_user/repos",
|
||||||
|
"events_url": "https://api.github.com/users/other_user/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/other_user/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requested_teams": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VGVhbTE=",
|
||||||
|
"url": "https://api.github.com/teams/1",
|
||||||
|
"html_url": "https://github.com/orgs/github/teams/justice-league",
|
||||||
|
"name": "Justice League",
|
||||||
|
"slug": "justice-league",
|
||||||
|
"description": "A great team.",
|
||||||
|
"privacy": "closed",
|
||||||
|
"permission": "admin",
|
||||||
|
"members_url": "https://api.github.com/teams/1/members{/member}",
|
||||||
|
"repositories_url": "https://api.github.com/teams/1/repos",
|
||||||
|
"parent": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"head": {
|
||||||
|
"label": "octocat:new-topic",
|
||||||
|
"ref": "new-topic",
|
||||||
|
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||||
|
"user": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"repo": {
|
||||||
|
"id": 1296269,
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
||||||
|
"name": "Hello-World",
|
||||||
|
"full_name": "octocat/Hello-World",
|
||||||
|
"owner": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"private": false,
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World",
|
||||||
|
"description": "This your first repo!",
|
||||||
|
"fork": false,
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||||
|
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||||
|
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
|
||||||
|
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
|
||||||
|
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
|
||||||
|
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||||
|
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||||
|
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
|
||||||
|
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||||
|
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
||||||
|
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||||
|
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||||
|
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||||
|
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
|
||||||
|
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
|
||||||
|
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||||
|
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||||
|
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||||
|
"hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks",
|
||||||
|
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||||
|
"homepage": "https://github.com",
|
||||||
|
"language": null,
|
||||||
|
"forks_count": 9,
|
||||||
|
"stargazers_count": 80,
|
||||||
|
"watchers_count": 80,
|
||||||
|
"size": 108,
|
||||||
|
"default_branch": "master",
|
||||||
|
"open_issues_count": 0,
|
||||||
|
"is_template": true,
|
||||||
|
"topics": [
|
||||||
|
"octocat",
|
||||||
|
"atom",
|
||||||
|
"electron",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"has_issues": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_downloads": true,
|
||||||
|
"archived": false,
|
||||||
|
"disabled": false,
|
||||||
|
"visibility": "public",
|
||||||
|
"pushed_at": "2011-01-26T19:06:43Z",
|
||||||
|
"created_at": "2011-01-26T19:01:12Z",
|
||||||
|
"updated_at": "2011-01-26T19:14:43Z",
|
||||||
|
"permissions": {
|
||||||
|
"admin": false,
|
||||||
|
"push": false,
|
||||||
|
"pull": true
|
||||||
|
},
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"template_repository": null,
|
||||||
|
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"allow_auto_merge": false,
|
||||||
|
"delete_branch_on_merge": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"subscribers_count": 42,
|
||||||
|
"network_count": 0,
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"url": "https://api.github.com/licenses/mit",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"node_id": "MDc6TGljZW5zZW1pdA==",
|
||||||
|
"html_url": "https://github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"forks": 1,
|
||||||
|
"open_issues": 1,
|
||||||
|
"watchers": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"base": {
|
||||||
|
"label": "octocat:master",
|
||||||
|
"ref": "master",
|
||||||
|
"sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e",
|
||||||
|
"user": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"repo": {
|
||||||
|
"id": 1296269,
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
||||||
|
"name": "Hello-World",
|
||||||
|
"full_name": "octocat/Hello-World",
|
||||||
|
"owner": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"private": false,
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World",
|
||||||
|
"description": "This your first repo!",
|
||||||
|
"fork": false,
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||||
|
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||||
|
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
|
||||||
|
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
|
||||||
|
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
|
||||||
|
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||||
|
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||||
|
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
|
||||||
|
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||||
|
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
||||||
|
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||||
|
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||||
|
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||||
|
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
|
||||||
|
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
|
||||||
|
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||||
|
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||||
|
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||||
|
"hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks",
|
||||||
|
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||||
|
"homepage": "https://github.com",
|
||||||
|
"language": null,
|
||||||
|
"forks_count": 9,
|
||||||
|
"stargazers_count": 80,
|
||||||
|
"watchers_count": 80,
|
||||||
|
"size": 108,
|
||||||
|
"default_branch": "master",
|
||||||
|
"open_issues_count": 0,
|
||||||
|
"is_template": true,
|
||||||
|
"topics": [
|
||||||
|
"octocat",
|
||||||
|
"atom",
|
||||||
|
"electron",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"has_issues": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_downloads": true,
|
||||||
|
"archived": false,
|
||||||
|
"disabled": false,
|
||||||
|
"visibility": "public",
|
||||||
|
"pushed_at": "2011-01-26T19:06:43Z",
|
||||||
|
"created_at": "2011-01-26T19:01:12Z",
|
||||||
|
"updated_at": "2011-01-26T19:14:43Z",
|
||||||
|
"permissions": {
|
||||||
|
"admin": false,
|
||||||
|
"push": false,
|
||||||
|
"pull": true
|
||||||
|
},
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"template_repository": null,
|
||||||
|
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"allow_auto_merge": false,
|
||||||
|
"delete_branch_on_merge": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"subscribers_count": 42,
|
||||||
|
"network_count": 0,
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"url": "https://api.github.com/licenses/mit",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"node_id": "MDc6TGljZW5zZW1pdA==",
|
||||||
|
"html_url": "https://github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"forks": 1,
|
||||||
|
"open_issues": 1,
|
||||||
|
"watchers": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_links": {
|
||||||
|
"self": {
|
||||||
|
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347"
|
||||||
|
},
|
||||||
|
"html": {
|
||||||
|
"href": "https://github.com/octocat/Hello-World/pull/1347"
|
||||||
|
},
|
||||||
|
"issue": {
|
||||||
|
"href": "https://api.github.com/repos/octocat/Hello-World/issues/1347"
|
||||||
|
},
|
||||||
|
"comments": {
|
||||||
|
"href": "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments"
|
||||||
|
},
|
||||||
|
"review_comments": {
|
||||||
|
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments"
|
||||||
|
},
|
||||||
|
"review_comment": {
|
||||||
|
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}"
|
||||||
|
},
|
||||||
|
"commits": {
|
||||||
|
"href": "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits"
|
||||||
|
},
|
||||||
|
"statuses": {
|
||||||
|
"href": "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"author_association": "OWNER",
|
||||||
|
"auto_merge": null,
|
||||||
|
"draft": false
|
||||||
|
}
|
||||||
|
]
|
76
tests/components/github/fixtures/releases.json
Normal file
76
tests/components/github/fixtures/releases.json
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/releases/1",
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World/releases/v1.0.0",
|
||||||
|
"assets_url": "https://api.github.com/repos/octocat/Hello-World/releases/1/assets",
|
||||||
|
"upload_url": "https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label}",
|
||||||
|
"tarball_url": "https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0",
|
||||||
|
"zipball_url": "https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDc6UmVsZWFzZTE=",
|
||||||
|
"tag_name": "v1.0.0",
|
||||||
|
"target_commitish": "master",
|
||||||
|
"name": "v1.0.0",
|
||||||
|
"body": "Description of the release",
|
||||||
|
"draft": false,
|
||||||
|
"prerelease": false,
|
||||||
|
"created_at": "2013-02-27T19:35:32Z",
|
||||||
|
"published_at": "2013-02-27T19:35:32Z",
|
||||||
|
"author": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World/releases/assets/1",
|
||||||
|
"browser_download_url": "https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDEyOlJlbGVhc2VBc3NldDE=",
|
||||||
|
"name": "example.zip",
|
||||||
|
"label": "short description",
|
||||||
|
"state": "uploaded",
|
||||||
|
"content_type": "application/zip",
|
||||||
|
"size": 1024,
|
||||||
|
"download_count": 42,
|
||||||
|
"created_at": "2013-02-27T19:35:32Z",
|
||||||
|
"updated_at": "2013-02-27T19:35:32Z",
|
||||||
|
"uploader": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
507
tests/components/github/fixtures/repository.json
Normal file
507
tests/components/github/fixtures/repository.json
Normal file
@ -0,0 +1,507 @@
|
|||||||
|
{
|
||||||
|
"id": 1296269,
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
||||||
|
"name": "Hello-World",
|
||||||
|
"full_name": "octocat/Hello-World",
|
||||||
|
"owner": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"private": false,
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World",
|
||||||
|
"description": "This your first repo!",
|
||||||
|
"fork": false,
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||||
|
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||||
|
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
|
||||||
|
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
|
||||||
|
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
|
||||||
|
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||||
|
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||||
|
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
|
||||||
|
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||||
|
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
||||||
|
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||||
|
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||||
|
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||||
|
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
|
||||||
|
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
|
||||||
|
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||||
|
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||||
|
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||||
|
"hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks",
|
||||||
|
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||||
|
"homepage": "https://github.com",
|
||||||
|
"language": null,
|
||||||
|
"forks_count": 9,
|
||||||
|
"forks": 9,
|
||||||
|
"stargazers_count": 80,
|
||||||
|
"watchers_count": 80,
|
||||||
|
"watchers": 80,
|
||||||
|
"size": 108,
|
||||||
|
"default_branch": "master",
|
||||||
|
"open_issues_count": 0,
|
||||||
|
"open_issues": 0,
|
||||||
|
"is_template": false,
|
||||||
|
"topics": [
|
||||||
|
"octocat",
|
||||||
|
"atom",
|
||||||
|
"electron",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"has_issues": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_downloads": true,
|
||||||
|
"archived": false,
|
||||||
|
"disabled": false,
|
||||||
|
"visibility": "public",
|
||||||
|
"pushed_at": "2011-01-26T19:06:43Z",
|
||||||
|
"created_at": "2011-01-26T19:01:12Z",
|
||||||
|
"updated_at": "2011-01-26T19:14:43Z",
|
||||||
|
"permissions": {
|
||||||
|
"pull": true,
|
||||||
|
"push": false,
|
||||||
|
"admin": false
|
||||||
|
},
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"template_repository": {
|
||||||
|
"id": 1296269,
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
||||||
|
"name": "Hello-World-Template",
|
||||||
|
"full_name": "octocat/Hello-World-Template",
|
||||||
|
"owner": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"private": false,
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World-Template",
|
||||||
|
"description": "This your first repo!",
|
||||||
|
"fork": false,
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World-Template",
|
||||||
|
"archive_url": "https://api.github.com/repos/octocat/Hello-World-Template/{archive_format}{/ref}",
|
||||||
|
"assignees_url": "https://api.github.com/repos/octocat/Hello-World-Template/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/octocat/Hello-World-Template/branches{/branch}",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World-Template/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/octocat/Hello-World-Template/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/octocat/Hello-World-Template/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/octocat/Hello-World-Template/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/octocat/Hello-World-Template/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/octocat/Hello-World-Template/contributors",
|
||||||
|
"deployments_url": "https://api.github.com/repos/octocat/Hello-World-Template/deployments",
|
||||||
|
"downloads_url": "https://api.github.com/repos/octocat/Hello-World-Template/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/octocat/Hello-World-Template/events",
|
||||||
|
"forks_url": "https://api.github.com/repos/octocat/Hello-World-Template/forks",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/tags{/sha}",
|
||||||
|
"git_url": "git:github.com/octocat/Hello-World-Template.git",
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/octocat/Hello-World-Template/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/octocat/Hello-World-Template/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/octocat/Hello-World-Template/labels{/name}",
|
||||||
|
"languages_url": "https://api.github.com/repos/octocat/Hello-World-Template/languages",
|
||||||
|
"merges_url": "https://api.github.com/repos/octocat/Hello-World-Template/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/octocat/Hello-World-Template/milestones{/number}",
|
||||||
|
"notifications_url": "https://api.github.com/repos/octocat/Hello-World-Template/notifications{?since,all,participating}",
|
||||||
|
"pulls_url": "https://api.github.com/repos/octocat/Hello-World-Template/pulls{/number}",
|
||||||
|
"releases_url": "https://api.github.com/repos/octocat/Hello-World-Template/releases{/id}",
|
||||||
|
"ssh_url": "git@github.com:octocat/Hello-World-Template.git",
|
||||||
|
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World-Template/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/octocat/Hello-World-Template/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World-Template/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/octocat/Hello-World-Template/subscription",
|
||||||
|
"tags_url": "https://api.github.com/repos/octocat/Hello-World-Template/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/octocat/Hello-World-Template/teams",
|
||||||
|
"trees_url": "https://api.github.com/repos/octocat/Hello-World-Template/git/trees{/sha}",
|
||||||
|
"clone_url": "https://github.com/octocat/Hello-World-Template.git",
|
||||||
|
"mirror_url": "git:git.example.com/octocat/Hello-World-Template",
|
||||||
|
"hooks_url": "https://api.github.com/repos/octocat/Hello-World-Template/hooks",
|
||||||
|
"svn_url": "https://svn.github.com/octocat/Hello-World-Template",
|
||||||
|
"homepage": "https://github.com",
|
||||||
|
"language": null,
|
||||||
|
"forks": 9,
|
||||||
|
"forks_count": 9,
|
||||||
|
"stargazers_count": 80,
|
||||||
|
"watchers_count": 80,
|
||||||
|
"watchers": 80,
|
||||||
|
"size": 108,
|
||||||
|
"default_branch": "master",
|
||||||
|
"open_issues": 0,
|
||||||
|
"open_issues_count": 0,
|
||||||
|
"is_template": true,
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"url": "https://api.github.com/licenses/mit",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"node_id": "MDc6TGljZW5zZW1pdA==",
|
||||||
|
"html_url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"topics": [
|
||||||
|
"octocat",
|
||||||
|
"atom",
|
||||||
|
"electron",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"has_issues": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_downloads": true,
|
||||||
|
"archived": false,
|
||||||
|
"disabled": false,
|
||||||
|
"visibility": "public",
|
||||||
|
"pushed_at": "2011-01-26T19:06:43Z",
|
||||||
|
"created_at": "2011-01-26T19:01:12Z",
|
||||||
|
"updated_at": "2011-01-26T19:14:43Z",
|
||||||
|
"permissions": {
|
||||||
|
"admin": false,
|
||||||
|
"push": false,
|
||||||
|
"pull": true
|
||||||
|
},
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"allow_auto_merge": false,
|
||||||
|
"delete_branch_on_merge": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"subscribers_count": 42,
|
||||||
|
"network_count": 0
|
||||||
|
},
|
||||||
|
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"allow_auto_merge": false,
|
||||||
|
"delete_branch_on_merge": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"subscribers_count": 42,
|
||||||
|
"network_count": 0,
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"url": "https://api.github.com/licenses/mit",
|
||||||
|
"node_id": "MDc6TGljZW5zZW1pdA=="
|
||||||
|
},
|
||||||
|
"organization": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "Organization",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"parent": {
|
||||||
|
"id": 1296269,
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
||||||
|
"name": "Hello-World",
|
||||||
|
"full_name": "octocat/Hello-World",
|
||||||
|
"owner": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"private": false,
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World",
|
||||||
|
"description": "This your first repo!",
|
||||||
|
"fork": false,
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||||
|
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||||
|
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
|
||||||
|
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
|
||||||
|
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
|
||||||
|
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||||
|
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||||
|
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
|
||||||
|
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||||
|
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
||||||
|
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||||
|
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||||
|
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||||
|
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
|
||||||
|
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
|
||||||
|
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||||
|
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||||
|
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||||
|
"hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks",
|
||||||
|
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||||
|
"homepage": "https://github.com",
|
||||||
|
"language": null,
|
||||||
|
"forks_count": 9,
|
||||||
|
"stargazers_count": 80,
|
||||||
|
"watchers_count": 80,
|
||||||
|
"size": 108,
|
||||||
|
"default_branch": "master",
|
||||||
|
"open_issues_count": 0,
|
||||||
|
"is_template": true,
|
||||||
|
"topics": [
|
||||||
|
"octocat",
|
||||||
|
"atom",
|
||||||
|
"electron",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"has_issues": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_downloads": true,
|
||||||
|
"archived": false,
|
||||||
|
"disabled": false,
|
||||||
|
"visibility": "public",
|
||||||
|
"pushed_at": "2011-01-26T19:06:43Z",
|
||||||
|
"created_at": "2011-01-26T19:01:12Z",
|
||||||
|
"updated_at": "2011-01-26T19:14:43Z",
|
||||||
|
"permissions": {
|
||||||
|
"admin": false,
|
||||||
|
"push": false,
|
||||||
|
"pull": true
|
||||||
|
},
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"allow_auto_merge": false,
|
||||||
|
"delete_branch_on_merge": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"subscribers_count": 42,
|
||||||
|
"network_count": 0,
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"url": "https://api.github.com/licenses/mit",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"node_id": "MDc6TGljZW5zZW1pdA==",
|
||||||
|
"html_url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"forks": 1,
|
||||||
|
"open_issues": 1,
|
||||||
|
"watchers": 1
|
||||||
|
},
|
||||||
|
"source": {
|
||||||
|
"id": 1296269,
|
||||||
|
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
|
||||||
|
"name": "Hello-World",
|
||||||
|
"full_name": "octocat/Hello-World",
|
||||||
|
"owner": {
|
||||||
|
"login": "octocat",
|
||||||
|
"id": 1,
|
||||||
|
"node_id": "MDQ6VXNlcjE=",
|
||||||
|
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
|
||||||
|
"gravatar_id": "",
|
||||||
|
"url": "https://api.github.com/users/octocat",
|
||||||
|
"html_url": "https://github.com/octocat",
|
||||||
|
"followers_url": "https://api.github.com/users/octocat/followers",
|
||||||
|
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
|
||||||
|
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
|
||||||
|
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
|
||||||
|
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
|
||||||
|
"organizations_url": "https://api.github.com/users/octocat/orgs",
|
||||||
|
"repos_url": "https://api.github.com/users/octocat/repos",
|
||||||
|
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
|
||||||
|
"received_events_url": "https://api.github.com/users/octocat/received_events",
|
||||||
|
"type": "User",
|
||||||
|
"site_admin": false
|
||||||
|
},
|
||||||
|
"private": false,
|
||||||
|
"html_url": "https://github.com/octocat/Hello-World",
|
||||||
|
"description": "This your first repo!",
|
||||||
|
"fork": false,
|
||||||
|
"url": "https://api.github.com/repos/octocat/Hello-World",
|
||||||
|
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
|
||||||
|
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
|
||||||
|
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
|
||||||
|
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
|
||||||
|
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
|
||||||
|
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
|
||||||
|
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
|
||||||
|
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
|
||||||
|
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
|
||||||
|
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
|
||||||
|
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
|
||||||
|
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
|
||||||
|
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
|
||||||
|
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
|
||||||
|
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
|
||||||
|
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
|
||||||
|
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
|
||||||
|
"git_url": "git:github.com/octocat/Hello-World.git",
|
||||||
|
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
|
||||||
|
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
|
||||||
|
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
|
||||||
|
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
|
||||||
|
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
|
||||||
|
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
|
||||||
|
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
|
||||||
|
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
|
||||||
|
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
|
||||||
|
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
|
||||||
|
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
|
||||||
|
"ssh_url": "git@github.com:octocat/Hello-World.git",
|
||||||
|
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
|
||||||
|
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
|
||||||
|
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
|
||||||
|
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
|
||||||
|
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
|
||||||
|
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
|
||||||
|
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
|
||||||
|
"clone_url": "https://github.com/octocat/Hello-World.git",
|
||||||
|
"mirror_url": "git:git.example.com/octocat/Hello-World",
|
||||||
|
"hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks",
|
||||||
|
"svn_url": "https://svn.github.com/octocat/Hello-World",
|
||||||
|
"homepage": "https://github.com",
|
||||||
|
"language": null,
|
||||||
|
"forks_count": 9,
|
||||||
|
"stargazers_count": 80,
|
||||||
|
"watchers_count": 80,
|
||||||
|
"size": 108,
|
||||||
|
"default_branch": "master",
|
||||||
|
"open_issues_count": 0,
|
||||||
|
"is_template": true,
|
||||||
|
"topics": [
|
||||||
|
"octocat",
|
||||||
|
"atom",
|
||||||
|
"electron",
|
||||||
|
"api"
|
||||||
|
],
|
||||||
|
"has_issues": true,
|
||||||
|
"has_projects": true,
|
||||||
|
"has_wiki": true,
|
||||||
|
"has_pages": false,
|
||||||
|
"has_downloads": true,
|
||||||
|
"archived": false,
|
||||||
|
"disabled": false,
|
||||||
|
"visibility": "public",
|
||||||
|
"pushed_at": "2011-01-26T19:06:43Z",
|
||||||
|
"created_at": "2011-01-26T19:01:12Z",
|
||||||
|
"updated_at": "2011-01-26T19:14:43Z",
|
||||||
|
"permissions": {
|
||||||
|
"admin": false,
|
||||||
|
"push": false,
|
||||||
|
"pull": true
|
||||||
|
},
|
||||||
|
"allow_rebase_merge": true,
|
||||||
|
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
|
||||||
|
"allow_squash_merge": true,
|
||||||
|
"allow_auto_merge": false,
|
||||||
|
"delete_branch_on_merge": true,
|
||||||
|
"allow_merge_commit": true,
|
||||||
|
"subscribers_count": 42,
|
||||||
|
"network_count": 0,
|
||||||
|
"license": {
|
||||||
|
"key": "mit",
|
||||||
|
"name": "MIT License",
|
||||||
|
"url": "https://api.github.com/licenses/mit",
|
||||||
|
"spdx_id": "MIT",
|
||||||
|
"node_id": "MDc6TGljZW5zZW1pdA==",
|
||||||
|
"html_url": "https://api.github.com/licenses/mit"
|
||||||
|
},
|
||||||
|
"forks": 1,
|
||||||
|
"open_issues": 1,
|
||||||
|
"watchers": 1
|
||||||
|
}
|
||||||
|
}
|
@ -47,11 +47,10 @@ async def test_entry_diagnostics(
|
|||||||
async def test_entry_diagnostics_exception(
|
async def test_entry_diagnostics_exception(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_client: ClientSession,
|
hass_client: ClientSession,
|
||||||
mock_config_entry: MockConfigEntry,
|
init_integration: MockConfigEntry,
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test config entry diagnostics with exception for ratelimit."""
|
"""Test config entry diagnostics with exception for ratelimit."""
|
||||||
await setup_github_integration(hass, mock_config_entry, aioclient_mock)
|
|
||||||
aioclient_mock.get(
|
aioclient_mock.get(
|
||||||
"https://api.github.com/rate_limit",
|
"https://api.github.com/rate_limit",
|
||||||
exc=GitHubException("error"),
|
exc=GitHubException("error"),
|
||||||
@ -60,7 +59,7 @@ async def test_entry_diagnostics_exception(
|
|||||||
result = await get_diagnostics_for_config_entry(
|
result = await get_diagnostics_for_config_entry(
|
||||||
hass,
|
hass,
|
||||||
hass_client,
|
hass_client,
|
||||||
mock_config_entry,
|
init_integration,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert (
|
assert (
|
||||||
|
42
tests/components/github/test_sensor.py
Normal file
42
tests/components/github/test_sensor.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
"""Test GitHub sensor."""
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from aiogithubapi import GitHubNotModifiedException
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from homeassistant.components.github.const import DEFAULT_UPDATE_INTERVAL
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.util import dt
|
||||||
|
|
||||||
|
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||||
|
|
||||||
|
TEST_SENSOR_ENTITY = "sensor.octocat_hello_world_latest_release"
|
||||||
|
|
||||||
|
|
||||||
|
async def test_sensor_updates_with_not_modified_content(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
init_integration: MockConfigEntry,
|
||||||
|
caplog: pytest.LogCaptureFixture,
|
||||||
|
) -> None:
|
||||||
|
"""Test the sensor updates by default GitHub sensors."""
|
||||||
|
state = hass.states.get(TEST_SENSOR_ENTITY)
|
||||||
|
assert state.state == "v1.0.0"
|
||||||
|
assert (
|
||||||
|
"Content for octocat/Hello-World with RepositoryReleaseDataUpdateCoordinator not modified"
|
||||||
|
not in caplog.text
|
||||||
|
)
|
||||||
|
|
||||||
|
with patch(
|
||||||
|
"aiogithubapi.namespaces.releases.GitHubReleasesNamespace.list",
|
||||||
|
side_effect=GitHubNotModifiedException,
|
||||||
|
):
|
||||||
|
|
||||||
|
async_fire_time_changed(hass, dt.utcnow() + DEFAULT_UPDATE_INTERVAL)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
assert (
|
||||||
|
"Content for octocat/Hello-World with RepositoryReleaseDataUpdateCoordinator not modified"
|
||||||
|
in caplog.text
|
||||||
|
)
|
||||||
|
new_state = hass.states.get(TEST_SENSOR_ENTITY)
|
||||||
|
assert state.state == new_state.state
|
Loading…
x
Reference in New Issue
Block a user