This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add data support for Change Requests (#92)
This exposes some APIs and schemas for change requests. It does not expose any UI-related components.
- Loading branch information
Showing
25 changed files
with
788 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
{ | ||
"id": 288639281, | ||
"number": "2843", | ||
"config": { | ||
"sudo": false, | ||
"dist": "trusty", | ||
"language": "python", | ||
"python": [ | ||
"3.5.2" | ||
], | ||
"branches": { | ||
"only": [ | ||
"master" | ||
] | ||
}, | ||
"cache": { | ||
"pip": true, | ||
"directories": [ | ||
"vendor/bundle", | ||
"node_modules" | ||
] | ||
}, | ||
"deploy": { | ||
"provider": "heroku", | ||
"api_key": { | ||
"secure": "hylw2GIHMvZKOKX3uPSaLEzVrUGEA9mzGEA0s4zK37W9HJCTnvAcmgRCwOkRuC4L7R4Zshdh/CGORNnBBgh1xx5JGYwkdnqtjHuUQmWEXCusrIURu/iEBNSsZZEPK7zBuwqMHj2yRm64JfbTDJsku3xdoA5Z8XJG5AMJGKLFgUQ=" | ||
}, | ||
"app": "docs-travis-ci-com", | ||
"skip_cleanup": true, | ||
"true": { | ||
"branch": [ | ||
"master" | ||
] | ||
} | ||
}, | ||
"notifications": { | ||
"slack": { | ||
"rooms": { | ||
"secure": "LPNgf0Ra6Vu6I7XuK7tcnyFWJg+becx1RfAR35feWK81sru8TyuldQIt7uAKMA8tqFTP8j1Af7iz7UDokbCCfDNCX1GxdAWgXs+UKpwhO89nsidHAsCkW2lWSEM0E3xtOJDyNFoauiHxBKGKUsApJTnf39H+EW9tWrqN5W2sZg8=" | ||
}, | ||
"on_success": "never" | ||
}, | ||
"webhooks": "https://docs.travis-ci.com/update_webhook_payload_doc" | ||
}, | ||
"install": [ | ||
"rvm use 2.3.1 --install", | ||
"bundle install --deployment" | ||
], | ||
"script": [ | ||
"bundle exec rake test" | ||
], | ||
".result": "configured", | ||
"global_env": [ | ||
"PATH=$HOME/.local/user/bin:$PATH" | ||
], | ||
"group": "stable" | ||
}, | ||
"type": "cron", | ||
"state": "passed", | ||
"status": 0, | ||
"result": 0, | ||
"status_message": "Passed", | ||
"result_message": "Passed", | ||
"started_at": "2017-10-16T16:08:56Z", | ||
"finished_at": "2017-10-16T16:12:35Z", | ||
"duration": 219, | ||
"build_url": "https://travis-ci.org/travis-ci/docs-travis-ci-com/builds/288639281", | ||
"commit_id": 84531696, | ||
"commit": "d79e3a6ff0cada29d731ed93de203f76a81d02c0", | ||
"base_commit": "d79e3a6ff0cada29d731ed93de203f76a81d02c0", | ||
"head_commit": "d79e3a6ff0cada29d731ed93de203f76a81d02c0", | ||
"branch": "master", | ||
"message": "Merge pull request #1389 from christopher-dG/patch-1\\n\\nJulia: Refer to PkgDev's generate instead of Pkg's", | ||
"compare_url": "https://github.com/travis-ci/docs-travis-ci-com/compare/eb58bd2fac2e339d0339689d9eb7290246805a1d...d79e3a6ff0cada29d731ed93de203f76a81d02c0", | ||
"committed_at": "2017-10-16T14:56:34Z", | ||
"author_name": "Plaindocs", | ||
"author_email": "[email protected]", | ||
"committer_name": "GitHub", | ||
"committer_email": "[email protected]", | ||
"pull_request": true, | ||
"pull_request_number": 123, | ||
"pull_request_title": "The title of the pull request", | ||
"tag": null, | ||
"repository": { | ||
"id": 1771959, | ||
"name": "docs-travis-ci-com", | ||
"owner_name": "travis-ci", | ||
"url": "http://docs.travis-ci.com" | ||
}, | ||
"matrix": [ | ||
{ | ||
"id": 288639284, | ||
"repository_id": 1771959, | ||
"parent_id": 288639281, | ||
"number": "2843.1", | ||
"state": "passed", | ||
"config": { | ||
"sudo": false, | ||
"dist": "trusty", | ||
"language": "python", | ||
"python": "3.5.2", | ||
"branches": { | ||
"only": [ | ||
"master" | ||
] | ||
}, | ||
"env": ["TEST_SUITE=integration"], | ||
"cache": { | ||
"pip": true, | ||
"directories": [ | ||
"vendor/bundle", | ||
"node_modules" | ||
] | ||
}, | ||
"notifications": { | ||
"slack": { | ||
"rooms": { | ||
"secure": "LPNgf0Ra6Vu6I7XuK7tcnyFWJg+becx1RfAR35feWK81sru8TyuldQIt7uAKMA8tqFTP8j1Af7iz7UDokbCCfDNCX1GxdAWgXs+UKpwhO89nsidHAsCkW2lWSEM0E3xtOJDyNFoauiHxBKGKUsApJTnf39H+EW9tWrqN5W2sZg8=" | ||
}, | ||
"on_success": "never" | ||
}, | ||
"webhooks": "https://docs.travis-ci.com/update_webhook_payload_doc" | ||
}, | ||
"install": [ | ||
"rvm use 2.3.1 --install", | ||
"bundle install --deployment" | ||
], | ||
"script": [ | ||
"bundle exec rake test" | ||
], | ||
".result": "configured", | ||
"global_env": [ | ||
"PATH=$HOME/.local/user/bin:$PATH" | ||
], | ||
"group": "stable", | ||
"os": "linux", | ||
"addons": { | ||
"deploy": { | ||
"provider": "heroku", | ||
"api_key": { | ||
"secure": "hylw2GIHMvZKOKX3uPSaLEzVrUGEA9mzGEA0s4zK37W9HJCTnvAcmgRCwOkRuC4L7R4Zshdh/CGORNnBBgh1xx5JGYwkdnqtjHuUQmWEXCusrIURu/iEBNSsZZEPK7zBuwqMHj2yRm64JfbTDJsku3xdoA5Z8XJG5AMJGKLFgUQ=" | ||
}, | ||
"app": "docs-travis-ci-com", | ||
"skip_cleanup": true, | ||
"true": { | ||
"branch": [ | ||
"master" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"status": 0, | ||
"result": 0, | ||
"commit": "d79e3a6ff0cada29d731ed93de203f76a81d02c0", | ||
"branch": "master", | ||
"message": "Merge pull request #1389 from christopher-dG/patch-1\\n\\nJulia: Refer to PkgDev's generate instead of Pkg's", | ||
"compare_url": "https://github.com/travis-ci/docs-travis-ci-com/compare/eb58bd2fac2e339d0339689d9eb7290246805a1d...d79e3a6ff0cada29d731ed93de203f76a81d02c0", | ||
"started_at": null, | ||
"finished_at": null, | ||
"committed_at": "2017-10-16T14:56:34Z", | ||
"author_name": "Plaindocs", | ||
"author_email": "[email protected]", | ||
"committer_name": "GitHub", | ||
"committer_email": "[email protected]", | ||
"allow_failure": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
tests/zeus/api/resources/test_repository_change_requests.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from zeus import factories | ||
from zeus.models import ChangeRequest | ||
|
||
|
||
def test_repo_change_request_list( | ||
client, default_login, default_change_request, default_repo, default_repo_access): | ||
resp = client.get( | ||
'/api/repos/{}/change-requests?show=all'.format( | ||
default_repo.get_full_name()) | ||
) | ||
assert resp.status_code == 200 | ||
data = resp.json() | ||
assert len(data) == 1 | ||
assert data[0]['id'] == str(default_change_request.id) | ||
|
||
|
||
def test_repo_change_request_list_without_access( | ||
client, default_login, default_change_request, default_repo): | ||
resp = client.get( | ||
'/api/repos/{}/change-requests'.format(default_repo.get_full_name())) | ||
assert resp.status_code == 404 | ||
|
||
|
||
def test_repo_change_request_list_mine_with_match( | ||
client, default_login, default_change_request, default_repo, default_repo_access | ||
): | ||
resp = client.get( | ||
'/api/repos/{}/change-requests?show=mine'.format(default_repo.get_full_name())) | ||
assert resp.status_code == 200 | ||
data = resp.json() | ||
assert len(data) == 1 | ||
|
||
|
||
def test_repo_change_request_list_mine_without_match( | ||
client, default_login, default_repo, default_repo_access | ||
): | ||
revision = factories.RevisionFactory(repository=default_repo) | ||
source = factories.SourceFactory(revision=revision) | ||
factories.BuildFactory(source=source) | ||
resp = client.get( | ||
'/api/repos/{}/change-requests?show=mine'.format(default_repo.get_full_name())) | ||
assert resp.status_code == 200 | ||
data = resp.json() | ||
assert len(data) == 0 | ||
|
||
|
||
def test_create_change_request( | ||
client, default_login, default_repo, default_repo_access, default_source): | ||
resp = client.post( | ||
'/api/repos/{}/change-requests'.format( | ||
default_repo.get_full_name(), | ||
), | ||
json={ | ||
'message': 'Hello world!', | ||
'provider': 'github', | ||
'external_id': '123', | ||
'parent_revision_sha': default_source.revision_sha, | ||
} | ||
) | ||
assert resp.status_code == 201 | ||
data = resp.json() | ||
assert data['id'] | ||
|
||
cr = ChangeRequest.query.unrestricted_unsafe().get(data['id']) | ||
assert cr.message == 'Hello world!' | ||
assert cr.external_id == '123' | ||
assert cr.provider == 'github' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.