2017-03-05 09:42:04 -05:00
|
|
|
// Imports
|
|
|
|
import {GithubPullRequests} from '../common/github-pull-requests';
|
2017-06-18 18:15:07 -04:00
|
|
|
import {BUILD_VERIFICATION_STATUS, BuildVerifier} from './build-verifier';
|
2017-06-20 13:22:32 -04:00
|
|
|
import {UploadError} from './upload-error';
|
2017-03-05 09:42:04 -05:00
|
|
|
|
|
|
|
// Run
|
|
|
|
// TODO(gkalpak): Add e2e tests to cover these interactions as well.
|
|
|
|
GithubPullRequests.prototype.addComment = () => Promise.resolve();
|
2017-06-20 13:22:32 -04:00
|
|
|
BuildVerifier.prototype.verify = (expectedPr: number, authHeader: string) => {
|
|
|
|
switch (authHeader) {
|
|
|
|
case 'FAKE_VERIFICATION_ERROR':
|
|
|
|
// For e2e tests, fake a verification error.
|
|
|
|
return Promise.reject(new UploadError(403, `Error while verifying upload for PR ${expectedPr}: Test`));
|
|
|
|
case 'FAKE_VERIFIED_NOT_TRUSTED':
|
|
|
|
// For e2e tests, fake a `verifiedNotTrusted` verification status.
|
|
|
|
return Promise.resolve(BUILD_VERIFICATION_STATUS.verifiedNotTrusted);
|
|
|
|
default:
|
|
|
|
// For e2e tests, default to `verifiedAndTrusted` verification status.
|
|
|
|
return Promise.resolve(BUILD_VERIFICATION_STATUS.verifiedAndTrusted);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2017-03-05 09:42:04 -05:00
|
|
|
// tslint:disable-next-line: no-var-requires
|
|
|
|
require('./index');
|