Beispiel #1
0
 async def post_check(*args, **kwargs):
     return mock.Mock(
         status_code=200,
         json=mock.Mock(
             return_value=github_types.GitHubCheckRun({
                 "head_sha": "ce587453ced02b1526dfb4cb910479d431683101",
                 "details_url": "https://example.com",
                 "status": "completed",
                 "conclusion": "neutral",
                 "name": "neutral",
                 "id": 1236,
                 "app": {
                     "id": 1234,
                     "name": "CI",
                     "owner": {
                         "type": "User",
                         "id": 1234,
                         "login": "******",
                         "avatar_url": "https://example.com",
                     },
                 },
                 "external_id": "",
                 "pull_requests": [],
                 "before": "4eef79d038b0327a5e035fd65059e556a55c6aa4",
                 "after": "4eef79d038b0327a5e035fd65059e556a55c6aa4",
                 "started_at": "",
                 "completed_at": "",
                 "html_url": "https://example.com",
                 "check_suite": {
                     "id": 1234
                 },
                 "output": {
                     "summary": "",
                     "title": "It runs!",
                     "text": "",
                     "annotations": [],
                     "annotations_count": 0,
                     "annotations_url": "https://example.com",
                 },
             })),
     )
Beispiel #2
0
 async def items_call(url, *args, **kwargs):
     if url == "/repos/Mergifyio/mergify-engine/commits/the-head-sha/status":
         return
     elif url == "/repos/Mergifyio/mergify-engine/commits/the-head-sha/check-runs":
         yield github_types.GitHubCheckRun({
             "head_sha": "ce587453ced02b1526dfb4cb910479d431683101",
             "details_url": "https://example.com",
             "status": "completed",
             "conclusion": "failure",
             "name": "failure",
             "id": 1234,
             "app": {
                 "id": 1234,
                 "name": "CI",
                 "owner": {
                     "type": "User",
                     "id": 1234,
                     "login": "******",
                     "avatar_url": "https://example.com",
                 },
             },
             "external_id": None,
             "pull_requests": [],
             "before": "4eef79d038b0327a5e035fd65059e556a55c6aa4",
             "after": "4eef79d038b0327a5e035fd65059e556a55c6aa4",
             "started_at": "",
             "completed_at": "",
             "html_url": "https://example.com",
             "check_suite": {
                 "id": 1234
             },
             "output": {
                 "summary": "",
                 "title": "It runs!",
                 "text": "",
                 "annotations": [],
                 "annotations_count": 0,
                 "annotations_url": "https://example.com",
             },
         })
         yield github_types.GitHubCheckRun({
             "head_sha": "ce587453ced02b1526dfb4cb910479d431683101",
             "details_url": "https://example.com",
             "status": "completed",
             "conclusion": "success",
             "name": "success",
             "id": 1235,
             "app": {
                 "id": 1234,
                 "name": "CI",
                 "owner": {
                     "type": "User",
                     "id": 1234,
                     "login": "******",
                     "avatar_url": "https://example.com",
                 },
             },
             "external_id": None,
             "pull_requests": [],
             "before": "4eef79d038b0327a5e035fd65059e556a55c6aa4",
             "after": "4eef79d038b0327a5e035fd65059e556a55c6aa4",
             "started_at": "",
             "completed_at": "",
             "html_url": "https://example.com",
             "check_suite": {
                 "id": 1234
             },
             "output": {
                 "summary": "",
                 "title": "It runs!",
                 "text": "",
                 "annotations": [],
                 "annotations_count": 0,
                 "annotations_url": "https://example.com",
             },
         })
         yield github_types.GitHubCheckRun({
             "head_sha": "ce587453ced02b1526dfb4cb910479d431683101",
             "details_url": "https://example.com",
             "status": "completed",
             "conclusion": "neutral",
             "name": "neutral",
             "id": 1236,
             "app": {
                 "id": 1234,
                 "name": "CI",
                 "owner": {
                     "type": "User",
                     "id": 1234,
                     "login": "******",
                     "avatar_url": "https://example.com",
                 },
             },
             "external_id": None,
             "pull_requests": [],
             "before": "4eef79d038b0327a5e035fd65059e556a55c6aa4",
             "after": "4eef79d038b0327a5e035fd65059e556a55c6aa4",
             "started_at": "",
             "completed_at": "",
             "html_url": "https://example.com",
             "check_suite": {
                 "id": 1234
             },
             "output": {
                 "summary": "",
                 "title": "It runs!",
                 "text": "",
                 "annotations": [],
                 "annotations_count": 0,
                 "annotations_url": "https://example.com",
             },
         })
         yield github_types.GitHubCheckRun({
             "head_sha": "ce587453ced02b1526dfb4cb910479d431683101",
             "details_url": "https://example.com",
             "status": "in_progress",
             "conclusion": None,
             "name": "pending",
             "id": 1237,
             "app": {
                 "id": 1234,
                 "name": "CI",
                 "owner": {
                     "type": "User",
                     "id": 1234,
                     "login": "******",
                     "avatar_url": "https://example.com",
                 },
             },
             "external_id": None,
             "pull_requests": [],
             "before": "4eef79d038b0327a5e035fd65059e556a55c6aa4",
             "after": "4eef79d038b0327a5e035fd65059e556a55c6aa4",
             "started_at": "",
             "completed_at": "",
             "html_url": "https://example.com",
             "check_suite": {
                 "id": 1234
             },
             "output": {
                 "summary": "",
                 "title": "It runs!",
                 "text": "",
                 "annotations": [],
                 "annotations_count": 0,
                 "annotations_url": "https://example.com",
             },
         })
     else:
         raise Exception(f"url not mocked: {url}")
Beispiel #3
0
CHECK_RUN = github_types.GitHubCheckRun(
    {
        "head_sha": github_types.SHAType("ce587453ced02b1526dfb4cb910479d431683101"),
        "details_url": "https://example.com",
        "status": "completed",
        "conclusion": "neutral",
        "name": "neutral",
        "id": 1236,
        "app": {
            "id": 1234,
            "name": "CI",
            "owner": {
                "type": "User",
                "id": github_types.GitHubAccountIdType(1234),
                "login": github_types.GitHubLogin("goo"),
                "avatar_url": "https://example.com",
            },
        },
        "external_id": "",
        "pull_requests": [],
        "before": github_types.SHAType("4eef79d038b0327a5e035fd65059e556a55c6aa4"),
        "after": github_types.SHAType("4eef79d038b0327a5e035fd65059e556a55c6aa4"),
        "started_at": github_types.ISODateTimeType("2004-12-02T22:00"),
        "completed_at": github_types.ISODateTimeType("2004-12-02T22:00"),
        "html_url": "https://example.com",
        "check_suite": {"id": 1234},
        "output": {
            "summary": "",
            "title": "It runs!",
            "text": "",
            "annotations": [],
            "annotations_count": 0,
            "annotations_url": "https://example.com",
        },
    }
)