diff --git a/lib/platform/bitbucket-server/__fixtures__/responses.ts b/lib/platform/bitbucket-server/__fixtures__/responses.ts deleted file mode 100644 index b78dada51ef29a192cc21c15a98d3b6f99cecaad..0000000000000000000000000000000000000000 --- a/lib/platform/bitbucket-server/__fixtures__/responses.ts +++ /dev/null @@ -1,586 +0,0 @@ -function generateRepo(endpoint: string, projectKey: string, repositorySlug: string) { - let projectKeyLower = projectKey.toLowerCase(); - return { - slug: repositorySlug, - id: 13076, - name: repositorySlug, - scmId: 'git', - state: 'AVAILABLE', - statusMessage: 'Available', - forkable: true, - project: { - key: projectKey, - id: 2900, - name: `${repositorySlug}'s name`, - public: false, - type: 'NORMAL', - links: { - self: [ - { href: `https://stash.renovatebot.com/projects/${projectKey}` }, - ], - }, - }, - public: false, - links: { - clone: [ - { - href: `${endpoint}/scm/${projectKeyLower}/${repositorySlug}.git`, - name: 'http', - }, - { - href: `ssh://git@stash.renovatebot.com:7999/${projectKeyLower}/${repositorySlug}.git`, - name: 'ssh', - }, - ], - self: [ - { - href: `${endpoint}/projects/${projectKey}/repos/${repositorySlug}/browse`, - }, - ], - }, - }; -} - -function generatePR(endpoint, projectKey, repositorySlug) { - return { - id: 5, - version: 1, - title: 'title', - description: '* Line 1\r\n* Line 2', - state: 'OPEN', - open: true, - closed: false, - createdDate: 1547853840016, - updatedDate: 1547853840016, - fromRef: { - id: 'refs/heads/userName1/pullRequest5', - displayId: 'userName1/pullRequest5', - latestCommit: '55efc02b2ab13a43a66cf705f5faacfcc6a762b4', - // Removed this with the idea it's not needed - // repository: {}, - }, - toRef: { - id: 'refs/heads/master', - displayId: 'master', - latestCommit: '0d9c7726c3d628b7e28af234595cfd20febdbf8e', - // Removed this with the idea it's not needed - // repository: {}, - }, - locked: false, - author: { - user: { - name: 'userName1', - emailAddress: 'userName1@renovatebot.com', - id: 144846, - displayName: 'Renovate Bot', - active: true, - slug: 'userName1', - type: 'NORMAL', - links: { - self: [{ href: `${endpoint}/users/userName1` }], - }, - }, - role: 'AUTHOR', - approved: false, - status: 'UNAPPROVED', - }, - reviewers: [ - { - user: { - name: 'userName2', - emailAddress: 'userName2@renovatebot.com', - id: 71155, - displayName: 'Renovate bot 2', - active: true, - slug: 'userName2', - type: 'NORMAL', - links: { - self: [{ href: `${endpoint}/users/userName2` }], - }, - }, - role: 'REVIEWER', - approved: false, - status: 'UNAPPROVED', - }, - ], - participants: [], - links: { - self: [ - { - href: `${endpoint}/projects/${projectKey}/repos/${repositorySlug}/pull-requests/5`, - }, - ], - }, - }; -} - -function generateServerResponses(endpoint) { - return { - baseURL: endpoint, - [`${endpoint}/rest/api/1.0/repos?permission=REPO_WRITE&state=AVAILABLE&limit=100`]: { - GET: { - size: 1, - limit: 100, - isLastPage: true, - values: [generateRepo(endpoint, 'SOME', 'repo')], - start: 0, - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos?limit=100`]: { - GET: { - size: 1, - limit: 25, - isLastPage: true, - values: [generateRepo(endpoint, 'SOME', 'repo')], - start: 0, - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo`]: { - GET: generateRepo(endpoint, 'SOME', 'repo'), - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/branches/default`]: { - GET: { - displayId: 'master', - }, - }, - // // TODO - I'm not sure there is an issues link to provide - // [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/issues`]: { - // 'GET': { - // values: [], - // }, - // }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests`]: { - POST: generatePR(endpoint, 'SOME', 'repo'), - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100`]: { - GET: { - isLastPage: true, - values: [generatePR(endpoint, 'SOME', 'repo')], - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3`]: { - GET: generatePR(endpoint, 'SOME', 'repo'), - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/merge`]: { - GET: { conflicted: false }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/commits?withCounts=true`]: { - GET: { - totalCount: 2, - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/4`]: { - GET: Promise.reject({ statusCode: 404 }), - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5`]: { - GET: generatePR(endpoint, 'SOME', 'repo'), - PUT: generatePR(endpoint, 'SOME', 'repo'), - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true`]: { - GET: { - totalCount: 1, - values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/participants`]: { - POST: { - user: { - name: 'jcitizen', - emailAddress: 'jane@example.com', - id: 101, - displayName: 'Jane Citizen', - active: true, - slug: 'jcitizen', - type: 'NORMAL', - }, - lastReviewedCommit: '7549846524f8aed2bd1c0249993ae1bf9d3c9998', - role: 'REVIEWER', - approved: false, - status: 'UNAPPROVED', - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/diff`]: { - GET: { - fromHash: 'afdcf5e55dfce85055a146783434b0e2a81722c1', - toHash: '590e661bb8c189b5a4bee115b475c9f14bf112bd', - contextLines: 10, - whitespace: 'SHOW', - diffs: [ - { - source: { - components: ['package.json'], - parent: '', - name: 'package.json', - extension: 'json', - toString: 'package.json', - }, - destination: { - components: ['package.json'], - parent: '', - name: 'package.json', - extension: 'json', - toString: 'package.json', - }, - hunks: [ - { - sourceLine: 47, - sourceSpan: 18, - destinationLine: 47, - destinationSpan: 18, - segments: [ - { - type: 'CONTEXT', - lines: [ - { - source: 47, - destination: 47, - line: ' "webpack": "4.28.0"', - truncated: false, - }, - { - source: 48, - destination: 48, - line: ' },', - truncated: false, - }, - { - source: 49, - destination: 49, - line: ' "license": "MIT",', - truncated: false, - }, - { - source: 50, - destination: 50, - line: ' "main": "dist/index.js",', - truncated: false, - }, - { - source: 51, - destination: 51, - line: ' "module": "dist/index.es.js",', - truncated: false, - }, - { - source: 52, - destination: 52, - line: ' "name": "removed-for-privacy",', - truncated: false, - }, - { - source: 53, - destination: 53, - line: ' "publishConfig": {', - truncated: false, - }, - { - source: 54, - destination: 54, - line: ' "registry": "https://npm.renovatebot.com/"', - truncated: false, - }, - { - source: 55, - destination: 55, - line: ' },', - truncated: false, - }, - { - source: 56, - destination: 56, - line: ' "scripts": {', - truncated: false, - }, - ], - truncated: false, - }, - { - type: 'REMOVED', - lines: [ - { - source: 57, - destination: 57, - line: - ' "build": "TS_NODE_PROJECT=\\"tsconfig.webpack.json\\" webpack --config=webpack.config.prod.ts",', - truncated: false, - }, - ], - truncated: false, - }, - { - type: 'ADDED', - lines: [ - { - source: 58, - destination: 57, - line: - ' "build": "npm run env TS_NODE_PROJECT=\\"tsconfig.webpack.json\\" -- && webpack --config=webpack.config.prod.ts",', - truncated: false, - }, - ], - truncated: false, - }, - { - type: 'CONTEXT', - lines: [ - { - source: 58, - destination: 58, - line: ' "clean": "rimraf dist",', - truncated: false, - }, - ], - truncated: false, - }, - { - type: 'REMOVED', - lines: [ - { - source: 59, - destination: 59, - line: - ' "dev": "TS_NODE_PROJECT=\\"tsconfig.webpack.json\\" webpack --config=webpack.config.ts",', - truncated: false, - }, - ], - truncated: false, - }, - { - type: 'ADDED', - lines: [ - { - source: 60, - destination: 59, - line: - ' "dev": "npm run env TS_NODE_PROJECT=\\"tsconfig.webpack.json\\" -- && webpack --config=webpack.config.ts",', - truncated: false, - }, - ], - truncated: false, - }, - { - type: 'CONTEXT', - lines: [ - { - source: 60, - destination: 60, - line: - ' "prepare": "npm run clean && npm run build",', - truncated: false, - }, - ], - truncated: false, - }, - { - type: 'REMOVED', - lines: [ - { - source: 61, - destination: 61, - line: - ' "start": "TS_NODE_PROJECT=\\"tsconfig.webpack.json\\" webpack-dev-server --env.NODE_ENV=development --env.buildenv=stage"', - truncated: false, - }, - ], - truncated: false, - }, - { - type: 'ADDED', - lines: [ - { - source: 62, - destination: 61, - line: - ' "start": "npm run env TS_NODE_PROJECT=\\"tsconfig.webpack.json\\" -- && webpack-dev-server --env.NODE_ENV=development --env.buildenv=stage"', - truncated: false, - }, - ], - truncated: false, - }, - { - type: 'CONTEXT', - lines: [ - { - source: 62, - destination: 62, - line: ' },', - truncated: false, - }, - { - source: 63, - destination: 63, - line: ' "version": "0.0.1"', - truncated: false, - }, - { - source: 64, - destination: 64, - line: '}', - truncated: false, - }, - ], - truncated: false, - }, - ], - truncated: false, - }, - ], - truncated: false, - }, - ], - truncated: false, - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/changes?withComments=false&limit=100`]: { - GET: { - "size": 1, - "limit": 25, - "isLastPage": true, - "values": [ - { - "contentId": "5c279d6c7a3a053a145905aa9682ce02c16449e9", - "fromContentId": "7b86ad1a05b4259b8fa54497a8be0bd359a405bd", - "path": { - "components": [ - "path", - "to", - "unreviewed", - "file.txt" - ], - "parent": "path/to/unreviewed", - "name": "file.txt", - "extension": "txt", - "toString": "path/to/unreviewed/file.txt" - }, - "executable": false, - "percentUnchanged": 98, - "type": "MOVE", - "nodeType": "FILE", - "srcPath": { - "components": [ - "path", - "to", - "file.txt" - ], - "parent": "path/to", - "name": "file.txt", - "extension": "txt", - "toString": "path/to/file.txt" - }, - "srcExecutable": false, - "links": { - "self": [ - null - ] - }, - "properties": { - "unreviewedCommits": 1 - } - } - ], - "start": 0 - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits`]: { - GET: { - values: [{}], - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge`]: { - GET: { conflicted: false }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1`]: { - POST: { - ...generatePR(endpoint, 'SOME', 'repo'), - ...{ - state: 'MERGED', - open: false, - closed: true, - createdDate: 1547853840016, - updatedDate: 1547853840016, - closedDate: 1547853840017, - }, - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100`]: { - GET: { - isLastPage: false, - nextPageStart: 1, - values: [ - { - action: 'COMMENTED', - commentAction: 'ADDED', - comment: { id: 21, text: '### some-subject\n\nblablabla' }, - }, - { - action: 'COMMENTED', - commentAction: 'ADDED', - comment: { id: 22, text: '!merge' }, - }, - ], - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1`]: { - GET: { - isLastPage: true, - values: [{ action: 'OTHER' }], - }, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments`]: { - POST: {}, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21`]: { - GET: { - version: 1, - }, - PUT: {}, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/22`]: { - GET: { - version: 1, - }, - PUT: {}, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21?version=1`]: { - DELETE: {}, - }, - [`${endpoint}/rest/api/1.0/projects/SOME/repos/branches`]: { - GET: { - isLastPage: true, - limit: 25, - size: 2, - start: 0, - values: [ - { displayId: 'master', id: 'refs/heads/master' }, - { displayId: 'branch', id: 'refs/heads/branch' }, - { displayId: 'renovate/branch', id: 'refs/heads/renovate/branch' }, - { displayId: 'renovate/upgrade', id: 'refs/heads/renovate/upgrade' }, - ], - }, - }, - [`${endpoint}/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e`]: { - GET: {}, - }, - [`${endpoint}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100`]: { - GET: { - isLastPage: true, - values: [{ key: 'context-1', state: 'SUCCESSFUL' }], - }, - }, - [`${endpoint}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e`]: { - POST: {}, - }, - [`${endpoint}/rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=13076&targetRepoId=13076`]: { - GET: [{ name: 'jcitizen' }], - }, - }; -} - -export default { - 'endpoint with no path': generateServerResponses( - 'https://stash.renovatebot.com' - ), - 'endpoint with path': generateServerResponses( - 'https://stash.renovatebot.com/vcs' - ), -}; diff --git a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap index 1dcb15dbae1c05f7d48b7ee4999fed64794312a7..d0f10c2bb9a95ebd4edf931b247070d9db8b3a5a 100644 --- a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap +++ b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap @@ -4,517 +4,1470 @@ exports[`platform/bitbucket-server endpoint with no path addAssignees() does not exports[`platform/bitbucket-server endpoint with no path addReviewers does not throw 1`] = `undefined`; -exports[`platform/bitbucket-server endpoint with no path addReviewers sends the reviewer name as a reviewer 1`] = ` +exports[`platform/bitbucket-server endpoint with no path addReviewers does not throw 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": false, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}},{\\"user\\":{\\"name\\":\\"name\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 98, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path addReviewers sends the reviewer name as a reviewer 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - Object { - "user": Object { - "name": "name", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with no path addReviewers sends the reviewer name as a reviewer 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}},{\\"user\\":{\\"name\\":\\"name\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 98, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path addReviewers sends the reviewer name as a reviewer 3`] = `Array []`; - exports[`platform/bitbucket-server endpoint with no path addReviewers throws 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}},{\\"user\\":{\\"name\\":\\"name\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 98, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path addReviewers throws 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - Object { - "user": Object { - "name": "name", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with no path addReviewers throws not-found 1 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path addReviewers throws not-found 1`] = ` +exports[`platform/bitbucket-server endpoint with no path addReviewers throws not-found 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path addReviewers throws not-found 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - Object { - "user": Object { - "name": "name", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with no path addReviewers throws not-found 3 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}},{\\"user\\":{\\"name\\":\\"name\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 98, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; exports[`platform/bitbucket-server endpoint with no path addReviewers throws repository-changed 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], -] -`; - -exports[`platform/bitbucket-server endpoint with no path addReviewers throws repository-changed 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - Object { - "user": Object { - "name": "name", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}},{\\"user\\":{\\"name\\":\\"name\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 98, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; exports[`platform/bitbucket-server endpoint with no path branchExists() getFileList() sends to gitFs 1`] = `true`; -exports[`platform/bitbucket-server endpoint with no path commitFiles() sends to gitFs 1`] = ` +exports[`platform/bitbucket-server endpoint with no path branchExists() getFileList() sends to gitFs 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path createPr() posts PR 1`] = ` +exports[`platform/bitbucket-server endpoint with no path commitFiles() sends to gitFs 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=13076&targetRepoId=13076", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path createPr() posts PR 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests", - Object { - "body": Object { - "description": "body", - "fromRef": Object { - "id": "refs/heads/branch", - }, - "reviewers": Array [ - Object { - "user": Object { - "name": "jcitizen", - }, - }, - ], - "title": "title", - "toRef": Object { - "id": "refs/heads/master", - }, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with no path createPr() posts PR 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=5&targetRepoId=5", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"fromRef\\":{\\"id\\":\\"refs/heads/branch\\"},\\"toRef\\":{\\"id\\":\\"refs/heads/master\\"},\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"jcitizen\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 153, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests", + }, ] `; exports[`platform/bitbucket-server endpoint with no path createPr() posts PR default branch 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=13076&targetRepoId=13076", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=5&targetRepoId=5", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"fromRef\\":{\\"id\\":\\"refs/heads/branch\\"},\\"toRef\\":{\\"id\\":\\"refs/heads/master\\"},\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"jcitizen\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 153, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path createPr() posts PR default branch 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests", - Object { - "body": Object { - "description": "body", - "fromRef": Object { - "id": "refs/heads/branch", - }, - "reviewers": Array [ - Object { - "user": Object { - "name": "jcitizen", - }, - }, - ], - "title": "title", - "toRef": Object { - "id": "refs/heads/master", - }, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with no path deleteBranch() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with no path deleteBranch() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path deleteBranch() sends to gitFs 1`] = `undefined`; - exports[`platform/bitbucket-server endpoint with no path deleteLAbel() does not throw 1`] = `undefined`; -exports[`platform/bitbucket-server endpoint with no path ensureComment() add comment if not found 1`] = ` +exports[`platform/bitbucket-server endpoint with no path ensureComment() add comment if not found 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "body": "{\\"text\\":\\"### topic\\\\n\\\\ncontent\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 31, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path ensureComment() add comment if not found 2`] = ` +exports[`platform/bitbucket-server endpoint with no path ensureComment() add comment if not found 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "body": "{\\"text\\":\\"content\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 18, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path ensureComment() add updates comment if necessary 1`] = ` +exports[`platform/bitbucket-server endpoint with no path ensureComment() add updates comment if necessary 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21", + }, + Object { + "body": "{\\"text\\":\\"### some-subject\\\\n\\\\nsome\\\\ncontent\\",\\"version\\":1}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 56, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path ensureComment() add updates comment if necessary 2`] = ` +exports[`platform/bitbucket-server endpoint with no path ensureComment() add updates comment if necessary 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "body": "{\\"text\\":\\"some\\\\ncontent\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 24, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments", + }, ] `; exports[`platform/bitbucket-server endpoint with no path ensureComment() does not throw 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/undefined/repos/undefined/pull-requests/3/activities?limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/pull-requests/3/activities?limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path ensureComment() skips comment 1`] = ` +exports[`platform/bitbucket-server endpoint with no path ensureComment() skips comment 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], -] -`; + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, +] +`; -exports[`platform/bitbucket-server endpoint with no path ensureComment() skips comment 2`] = ` +exports[`platform/bitbucket-server endpoint with no path ensureComment() skips comment 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, ] `; exports[`platform/bitbucket-server endpoint with no path ensureCommentRemoval() deletes comment by content if found 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/22", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/22", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "DELETE", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/22?version=1", + }, ] `; exports[`platform/bitbucket-server endpoint with no path ensureCommentRemoval() deletes comment by topic if found 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "DELETE", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21?version=1", + }, ] `; exports[`platform/bitbucket-server endpoint with no path ensureCommentRemoval() deletes nothing 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, ] `; exports[`platform/bitbucket-server endpoint with no path ensureCommentRemoval() does not throw 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/undefined/repos/undefined/pull-requests/5/activities?limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/pull-requests/5/activities?limit=100&start=1", + }, ] `; exports[`platform/bitbucket-server endpoint with no path findPr() has no pr 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, ] `; @@ -535,35 +1488,145 @@ Object { exports[`platform/bitbucket-server endpoint with no path findPr() has pr 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with no path getAllRenovateBranches() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with no path getAllRenovateBranches() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with no path getBranchLastCommitTime() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with no path getBranchLastCommitTime() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with no path getBranchPr() has no pr 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, ] `; @@ -591,180 +1654,526 @@ Object { exports[`platform/bitbucket-server endpoint with no path getBranchPr() has pr 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, ] `; exports[`platform/bitbucket-server endpoint with no path getBranchStatus() should be failed 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, ] `; exports[`platform/bitbucket-server endpoint with no path getBranchStatus() should be pending 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, ] `; exports[`platform/bitbucket-server endpoint with no path getBranchStatus() should be success 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with no path getBranchStatus() throws repository-changed 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; exports[`platform/bitbucket-server endpoint with no path getBranchStatusCheck() should be failure 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with no path getBranchStatusCheck() should be null 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with no path getBranchStatusCheck() should be pending 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with no path getBranchStatusCheck() should be success 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with no path getCommitMessages() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with no path getCommitMessages() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with no path getFile() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with no path getFile() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with no path getFileList() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with no path getFileList() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with no path getPr() canRebase 1`] = ` Object { "body": "* Line 1 @@ -833,66 +2242,138 @@ Object { exports[`platform/bitbucket-server endpoint with no path getPr() canRebase 4`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/3", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/commits?withCounts=true", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, ] `; @@ -920,30 +2401,66 @@ Object { exports[`platform/bitbucket-server endpoint with no path getPr() gets a PR 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, ] `; @@ -966,18 +2483,42 @@ Object { exports[`platform/bitbucket-server endpoint with no path getPr() gets a closed PR 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; @@ -1018,25 +2559,59 @@ Array [ exports[`platform/bitbucket-server endpoint with no path getPrList() has pr 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with no path getRepos() returns repos 1`] = ` Array [ - Array [ - "./rest/api/1.0/repos?permission=REPO_WRITE&state=AVAILABLE&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/repos?permission=REPO_WRITE&state=AVAILABLE&limit=100", + }, ] `; @@ -1053,6 +2628,64 @@ Object { } `; +exports[`platform/bitbucket-server endpoint with no path initRepo() does not throw 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/browse/renovate.json?limit=20000", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with no path initRepo() throws disabled 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/browse/renovate.json?limit=20000", + }, +] +`; + exports[`platform/bitbucket-server endpoint with no path initRepo() works 1`] = ` Object { "baseBranch": "master", @@ -1060,1049 +2693,2932 @@ Object { } `; +exports[`platform/bitbucket-server endpoint with no path initRepo() works 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with no path isBranchStale() sends to gitFs 1`] = `false`; +exports[`platform/bitbucket-server endpoint with no path isBranchStale() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with no path mergeBranch() sends to gitFs 1`] = `undefined`; -exports[`platform/bitbucket-server endpoint with no path mergePr() posts Merge 1`] = ` +exports[`platform/bitbucket-server endpoint with no path mergeBranch() sends to gitFs 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path mergePr() posts Merge 2`] = ` +exports[`platform/bitbucket-server endpoint with no path mergePr() posts Merge 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", + }, ] `; exports[`platform/bitbucket-server endpoint with no path mergePr() throws conflicted 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path mergePr() throws conflicted 2`] = ` +exports[`platform/bitbucket-server endpoint with no path mergePr() throws not-found 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path mergePr() throws not-found 1`] = ` +exports[`platform/bitbucket-server endpoint with no path mergePr() throws not-found 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path mergePr() throws not-found 2`] = ` +exports[`platform/bitbucket-server endpoint with no path mergePr() throws not-found 3 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", + }, ] `; exports[`platform/bitbucket-server endpoint with no path mergePr() unknown error 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path mergePr() unknown error 2`] = ` +exports[`platform/bitbucket-server endpoint with no path repoForceRebase() return false if ff strategy is enabled 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path setBaseBranch() updates file list 1`] = ` +exports[`platform/bitbucket-server endpoint with no path repoForceRebase() return false if no-ff strategy is enabled 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path setBranchStatus() should be success 1`] = ` +exports[`platform/bitbucket-server endpoint with no path repoForceRebase() return false if rebase-no-ff strategy is enabled 1`] = ` Array [ - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path setBranchStatus() should be success 2`] = ` +exports[`platform/bitbucket-server endpoint with no path repoForceRebase() return false if squash strategy is enabled 1`] = ` Array [ - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "body": Object { - "description": null, - "key": "context-2", - "state": "SUCCESSFUL", - "url": "https://renovatebot.com", - }, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "body": Object { - "description": null, - "key": "context-2", - "state": "FAILED", - "url": "https://renovatebot.com", - }, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "body": Object { - "description": null, - "key": "context-2", - "state": "FAILED", - "url": "https://renovatebot.com", - }, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "body": Object { - "description": null, - "key": "context-2", - "state": "INPROGRESS", - "url": "https://renovatebot.com", - }, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "body": Object { - "description": null, - "key": "context-2", - "state": "SUCCESSFUL", - "url": "https://renovatebot.com", - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path updatePr() puts PR 1`] = ` +exports[`platform/bitbucket-server endpoint with no path repoForceRebase() return true if ff-only strategy is enabled 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path updatePr() puts PR 2`] = ` +exports[`platform/bitbucket-server endpoint with no path repoForceRebase() return true if rebase-ff-only strategy is enabled 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "description": "body", - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path updatePr() throws 1`] = ` +exports[`platform/bitbucket-server endpoint with no path repoForceRebase() return true if squash-ff-only strategy is enabled 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path updatePr() throws 2`] = ` +exports[`platform/bitbucket-server endpoint with no path repoForceRebase() returns false on missing defaultStrategy 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "description": "body", - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path updatePr() throws not-found 1`] = ` +exports[`platform/bitbucket-server endpoint with no path repoForceRebase() returns false on missing mergeConfig 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path updatePr() throws not-found 2`] = ` +exports[`platform/bitbucket-server endpoint with no path setBaseBranch() updates file list 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "description": "body", - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path updatePr() throws repository-changed 1`] = ` +exports[`platform/bitbucket-server endpoint with no path setBranchStatus() should be success 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "body": "{\\"key\\":\\"context-2\\",\\"description\\":null,\\"url\\":\\"https://renovatebot.com\\",\\"state\\":\\"SUCCESSFUL\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 91, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with no path updatePr() throws repository-changed 2`] = ` +exports[`platform/bitbucket-server endpoint with no path setBranchStatus() should be success 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "description": "body", - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "body": "{\\"key\\":\\"context-2\\",\\"description\\":null,\\"url\\":\\"https://renovatebot.com\\",\\"state\\":\\"FAILED\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 87, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with path addAssignees() does not throw 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with no path setBranchStatus() should be success 3 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "body": "{\\"key\\":\\"context-2\\",\\"description\\":null,\\"url\\":\\"https://renovatebot.com\\",\\"state\\":\\"FAILED\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 87, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, +] +`; -exports[`platform/bitbucket-server endpoint with path addReviewers does not throw 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with no path setBranchStatus() should be success 4 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "body": "{\\"key\\":\\"context-2\\",\\"description\\":null,\\"url\\":\\"https://renovatebot.com\\",\\"state\\":\\"INPROGRESS\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 91, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, +] +`; -exports[`platform/bitbucket-server endpoint with path addReviewers sends the reviewer name as a reviewer 1`] = ` +exports[`platform/bitbucket-server endpoint with no path setBranchStatus() should be success 5 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": false, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "body": "{\\"key\\":\\"context-2\\",\\"description\\":null,\\"url\\":\\"https://renovatebot.com\\",\\"state\\":\\"SUCCESSFUL\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 91, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, ] `; -exports[`platform/bitbucket-server endpoint with path addReviewers sends the reviewer name as a reviewer 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - Object { - "user": Object { - "name": "name", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with no path setBranchStatus() should be success 6 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with path addReviewers sends the reviewer name as a reviewer 3`] = `Array []`; +exports[`platform/bitbucket-server endpoint with no path updatePr() puts PR 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 94, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, +] +`; -exports[`platform/bitbucket-server endpoint with path addReviewers throws 1`] = ` +exports[`platform/bitbucket-server endpoint with no path updatePr() throws 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 94, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; -exports[`platform/bitbucket-server endpoint with path addReviewers throws 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - Object { - "user": Object { - "name": "name", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with no path updatePr() throws not-found 1 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with path addReviewers throws not-found 1`] = ` +exports[`platform/bitbucket-server endpoint with no path updatePr() throws not-found 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", + }, ] `; -exports[`platform/bitbucket-server endpoint with path addReviewers throws not-found 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - Object { - "user": Object { - "name": "name", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with no path updatePr() throws not-found 3 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 94, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; -exports[`platform/bitbucket-server endpoint with path addReviewers throws repository-changed 1`] = ` +exports[`platform/bitbucket-server endpoint with no path updatePr() throws repository-changed 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 94, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; -exports[`platform/bitbucket-server endpoint with path addReviewers throws repository-changed 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - Object { - "user": Object { - "name": "name", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with path addAssignees() does not throw 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with path addReviewers does not throw 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with path addReviewers does not throw 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}},{\\"user\\":{\\"name\\":\\"name\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 98, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, ] `; -exports[`platform/bitbucket-server endpoint with path branchExists() getFileList() sends to gitFs 1`] = `true`; +exports[`platform/bitbucket-server endpoint with path addReviewers sends the reviewer name as a reviewer 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}},{\\"user\\":{\\"name\\":\\"name\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 98, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, +] +`; -exports[`platform/bitbucket-server endpoint with path commitFiles() sends to gitFs 1`] = ` +exports[`platform/bitbucket-server endpoint with path addReviewers throws 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}},{\\"user\\":{\\"name\\":\\"name\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 98, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; -exports[`platform/bitbucket-server endpoint with path createPr() posts PR 1`] = ` +exports[`platform/bitbucket-server endpoint with path addReviewers throws not-found 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=13076&targetRepoId=13076", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with path createPr() posts PR 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests", - Object { - "body": Object { - "description": "body", - "fromRef": Object { - "id": "refs/heads/branch", - }, - "reviewers": Array [ - Object { - "user": Object { - "name": "jcitizen", - }, - }, - ], - "title": "title", - "toRef": Object { - "id": "refs/heads/master", - }, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with path addReviewers throws not-found 2 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", + }, ] `; -exports[`platform/bitbucket-server endpoint with path createPr() posts PR default branch 1`] = ` +exports[`platform/bitbucket-server endpoint with path addReviewers throws not-found 3 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=13076&targetRepoId=13076", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}},{\\"user\\":{\\"name\\":\\"name\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 98, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; -exports[`platform/bitbucket-server endpoint with path createPr() posts PR default branch 2`] = ` -Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests", - Object { - "body": Object { - "description": "body", - "fromRef": Object { - "id": "refs/heads/branch", - }, - "reviewers": Array [ - Object { - "user": Object { - "name": "jcitizen", - }, - }, - ], - "title": "title", - "toRef": Object { - "id": "refs/heads/master", - }, - }, - }, - ], +exports[`platform/bitbucket-server endpoint with path addReviewers throws repository-changed 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}},{\\"user\\":{\\"name\\":\\"name\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 98, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path branchExists() getFileList() sends to gitFs 1`] = `true`; + +exports[`platform/bitbucket-server endpoint with path branchExists() getFileList() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path commitFiles() sends to gitFs 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path createPr() posts PR 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=5&targetRepoId=5", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"fromRef\\":{\\"id\\":\\"refs/heads/branch\\"},\\"toRef\\":{\\"id\\":\\"refs/heads/master\\"},\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"jcitizen\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 153, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path createPr() posts PR default branch 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=5&targetRepoId=5", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"fromRef\\":{\\"id\\":\\"refs/heads/branch\\"},\\"toRef\\":{\\"id\\":\\"refs/heads/master\\"},\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"jcitizen\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 153, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests", + }, ] `; exports[`platform/bitbucket-server endpoint with path deleteBranch() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with path deleteBranch() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with path deleteLAbel() does not throw 1`] = `undefined`; -exports[`platform/bitbucket-server endpoint with path ensureComment() add comment if not found 1`] = ` +exports[`platform/bitbucket-server endpoint with path ensureComment() add comment if not found 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "body": "{\\"text\\":\\"### topic\\\\n\\\\ncontent\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 31, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments", + }, ] `; -exports[`platform/bitbucket-server endpoint with path ensureComment() add comment if not found 2`] = ` +exports[`platform/bitbucket-server endpoint with path ensureComment() add comment if not found 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "body": "{\\"text\\":\\"content\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 18, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments", + }, ] `; -exports[`platform/bitbucket-server endpoint with path ensureComment() add updates comment if necessary 1`] = ` +exports[`platform/bitbucket-server endpoint with path ensureComment() add updates comment if necessary 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21", + }, + Object { + "body": "{\\"text\\":\\"### some-subject\\\\n\\\\nsome\\\\ncontent\\",\\"version\\":1}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 56, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21", + }, ] `; -exports[`platform/bitbucket-server endpoint with path ensureComment() add updates comment if necessary 2`] = ` +exports[`platform/bitbucket-server endpoint with path ensureComment() add updates comment if necessary 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "body": "{\\"text\\":\\"some\\\\ncontent\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 24, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments", + }, ] `; exports[`platform/bitbucket-server endpoint with path ensureComment() does not throw 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/undefined/repos/undefined/pull-requests/3/activities?limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/pull-requests/3/activities?limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with path ensureComment() skips comment 1`] = ` +exports[`platform/bitbucket-server endpoint with path ensureComment() skips comment 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, ] `; -exports[`platform/bitbucket-server endpoint with path ensureComment() skips comment 2`] = ` +exports[`platform/bitbucket-server endpoint with path ensureComment() skips comment 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, ] `; exports[`platform/bitbucket-server endpoint with path ensureCommentRemoval() deletes comment by content if found 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/22", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/22", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "DELETE", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/22?version=1", + }, ] `; exports[`platform/bitbucket-server endpoint with path ensureCommentRemoval() deletes comment by topic if found 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "DELETE", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21?version=1", + }, ] `; exports[`platform/bitbucket-server endpoint with path ensureCommentRemoval() deletes nothing 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1", + }, ] `; exports[`platform/bitbucket-server endpoint with path ensureCommentRemoval() does not throw 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/undefined/repos/undefined/pull-requests/5/activities?limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/pull-requests/5/activities?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/pull-requests/5/activities?limit=100&start=1", + }, ] `; exports[`platform/bitbucket-server endpoint with path findPr() has no pr 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, ] `; @@ -2123,35 +5639,145 @@ Object { exports[`platform/bitbucket-server endpoint with path findPr() has pr 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with path getAllRenovateBranches() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with path getAllRenovateBranches() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with path getBranchLastCommitTime() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with path getBranchLastCommitTime() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with path getBranchPr() has no pr 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, ] `; @@ -2179,180 +5805,526 @@ Object { exports[`platform/bitbucket-server endpoint with path getBranchPr() has pr 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, ] `; exports[`platform/bitbucket-server endpoint with path getBranchStatus() should be failed 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, ] `; exports[`platform/bitbucket-server endpoint with path getBranchStatus() should be pending 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, ] `; exports[`platform/bitbucket-server endpoint with path getBranchStatus() should be success 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path getBranchStatus() throws repository-changed 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; exports[`platform/bitbucket-server endpoint with path getBranchStatusCheck() should be failure 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with path getBranchStatusCheck() should be null 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with path getBranchStatusCheck() should be pending 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with path getBranchStatusCheck() should be success 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path getCommitMessages() sends to gitFs 1`] = `undefined`; + +exports[`platform/bitbucket-server endpoint with path getCommitMessages() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with path getCommitMessages() sends to gitFs 1`] = `undefined`; - exports[`platform/bitbucket-server endpoint with path getFile() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with path getFile() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with path getFileList() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with path getFileList() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with path getPr() canRebase 1`] = ` Object { "body": "* Line 1 @@ -2421,66 +6393,138 @@ Object { exports[`platform/bitbucket-server endpoint with path getPr() canRebase 4`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/3", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/commits?withCounts=true", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, ] `; @@ -2508,30 +6552,66 @@ Object { exports[`platform/bitbucket-server endpoint with path getPr() gets a PR 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, ] `; @@ -2554,18 +6634,42 @@ Object { exports[`platform/bitbucket-server endpoint with path getPr() gets a closed PR 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; @@ -2606,25 +6710,59 @@ Array [ exports[`platform/bitbucket-server endpoint with path getPrList() has pr 2`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100", + }, ] `; exports[`platform/bitbucket-server endpoint with path getRepos() returns repos 1`] = ` Array [ - Array [ - "./rest/api/1.0/repos?permission=REPO_WRITE&state=AVAILABLE&limit=100", - undefined, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/repos?permission=REPO_WRITE&state=AVAILABLE&limit=100", + }, ] `; @@ -2641,6 +6779,64 @@ Object { } `; +exports[`platform/bitbucket-server endpoint with path initRepo() does not throw 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/browse/renovate.json?limit=20000", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path initRepo() throws disabled 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/browse/renovate.json?limit=20000", + }, +] +`; + exports[`platform/bitbucket-server endpoint with path initRepo() works 1`] = ` Object { "baseBranch": "master", @@ -2648,530 +6844,1460 @@ Object { } `; +exports[`platform/bitbucket-server endpoint with path initRepo() works 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with path isBranchStale() sends to gitFs 1`] = `false`; +exports[`platform/bitbucket-server endpoint with path isBranchStale() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with path mergeBranch() sends to gitFs 1`] = `undefined`; +exports[`platform/bitbucket-server endpoint with path mergeBranch() sends to gitFs 2`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + exports[`platform/bitbucket-server endpoint with path mergePr() posts Merge 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path mergePr() throws conflicted 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path mergePr() throws not-found 1 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path mergePr() throws not-found 2 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path mergePr() throws not-found 3 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path mergePr() unknown error 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path repoForceRebase() return false if ff strategy is enabled 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path repoForceRebase() return false if no-ff strategy is enabled 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path repoForceRebase() return false if rebase-no-ff strategy is enabled 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, +] +`; + +exports[`platform/bitbucket-server endpoint with path repoForceRebase() return false if squash strategy is enabled 1`] = ` +Array [ + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with path mergePr() posts Merge 2`] = ` +exports[`platform/bitbucket-server endpoint with path repoForceRebase() return true if ff-only strategy is enabled 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with path mergePr() throws conflicted 1`] = ` +exports[`platform/bitbucket-server endpoint with path repoForceRebase() return true if rebase-ff-only strategy is enabled 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with path mergePr() throws conflicted 2`] = ` +exports[`platform/bitbucket-server endpoint with path repoForceRebase() return true if squash-ff-only strategy is enabled 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with path mergePr() throws not-found 1`] = ` +exports[`platform/bitbucket-server endpoint with path repoForceRebase() returns false on missing defaultStrategy 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with path mergePr() throws not-found 2`] = ` +exports[`platform/bitbucket-server endpoint with path repoForceRebase() returns false on missing mergeConfig 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests", + }, ] `; -exports[`platform/bitbucket-server endpoint with path mergePr() unknown error 1`] = ` +exports[`platform/bitbucket-server endpoint with path setBaseBranch() updates file list 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with path mergePr() unknown error 2`] = ` +exports[`platform/bitbucket-server endpoint with path setBranchStatus() should be success 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "body": "{\\"key\\":\\"context-2\\",\\"description\\":null,\\"url\\":\\"https://renovatebot.com\\",\\"state\\":\\"SUCCESSFUL\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 91, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with path setBaseBranch() updates file list 1`] = ` +exports[`platform/bitbucket-server endpoint with path setBranchStatus() should be success 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "body": "{\\"key\\":\\"context-2\\",\\"description\\":null,\\"url\\":\\"https://renovatebot.com\\",\\"state\\":\\"FAILED\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 87, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with path setBranchStatus() should be success 1`] = ` +exports[`platform/bitbucket-server endpoint with path setBranchStatus() should be success 3 1`] = ` Array [ - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": false, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "body": "{\\"key\\":\\"context-2\\",\\"description\\":null,\\"url\\":\\"https://renovatebot.com\\",\\"state\\":\\"FAILED\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 87, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with path setBranchStatus() should be success 2`] = ` +exports[`platform/bitbucket-server endpoint with path setBranchStatus() should be success 4 1`] = ` Array [ - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "body": Object { - "description": null, - "key": "context-2", - "state": "SUCCESSFUL", - "url": "https://renovatebot.com", - }, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "body": Object { - "description": null, - "key": "context-2", - "state": "FAILED", - "url": "https://renovatebot.com", - }, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "body": Object { - "description": null, - "key": "context-2", - "state": "FAILED", - "url": "https://renovatebot.com", - }, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "body": Object { - "description": null, - "key": "context-2", - "state": "INPROGRESS", - "url": "https://renovatebot.com", - }, - }, - ], - Array [ - "./rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", - Object { - "body": Object { - "description": null, - "key": "context-2", - "state": "SUCCESSFUL", - "url": "https://renovatebot.com", - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "body": "{\\"key\\":\\"context-2\\",\\"description\\":null,\\"url\\":\\"https://renovatebot.com\\",\\"state\\":\\"INPROGRESS\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 91, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with path updatePr() puts PR 1`] = ` +exports[`platform/bitbucket-server endpoint with path setBranchStatus() should be success 5 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, + Object { + "body": "{\\"key\\":\\"context-2\\",\\"description\\":null,\\"url\\":\\"https://renovatebot.com\\",\\"state\\":\\"SUCCESSFUL\\"}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 91, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "POST", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e", + }, ] `; -exports[`platform/bitbucket-server endpoint with path updatePr() puts PR 2`] = ` +exports[`platform/bitbucket-server endpoint with path setBranchStatus() should be success 6 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "description": "body", - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100", + }, ] `; -exports[`platform/bitbucket-server endpoint with path updatePr() throws 1`] = ` +exports[`platform/bitbucket-server endpoint with path updatePr() puts PR 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 94, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; -exports[`platform/bitbucket-server endpoint with path updatePr() throws 2`] = ` +exports[`platform/bitbucket-server endpoint with path updatePr() throws 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "description": "body", - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 94, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; -exports[`platform/bitbucket-server endpoint with path updatePr() throws not-found 1`] = ` +exports[`platform/bitbucket-server endpoint with path updatePr() throws not-found 1 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, ] `; -exports[`platform/bitbucket-server endpoint with path updatePr() throws not-found 2`] = ` +exports[`platform/bitbucket-server endpoint with path updatePr() throws not-found 2 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "description": "body", - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/4", + }, ] `; -exports[`platform/bitbucket-server endpoint with path updatePr() throws repository-changed 1`] = ` +exports[`platform/bitbucket-server endpoint with path updatePr() throws not-found 3 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/branches/default", - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", - Object { - "useCache": true, - }, - ], - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", - Object { - "useCache": true, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 94, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; -exports[`platform/bitbucket-server endpoint with path updatePr() throws repository-changed 2`] = ` +exports[`platform/bitbucket-server endpoint with path updatePr() throws repository-changed 1`] = ` Array [ - Array [ - "./rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", - Object { - "body": Object { - "description": "body", - "reviewers": Array [ - Object { - "user": Object { - "name": "userName2", - }, - }, - ], - "title": "title", - "version": 1, - }, - }, - ], + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge", + }, + Object { + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "GET", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true", + }, + Object { + "body": "{\\"title\\":\\"title\\",\\"description\\":\\"body\\",\\"version\\":1,\\"reviewers\\":[{\\"user\\":{\\"name\\":\\"userName2\\"}}]}", + "headers": Object { + "accept": "application/json", + "accept-encoding": "gzip, deflate", + "authorization": "Basic YWJjOjEyMw==", + "content-length": 94, + "content-type": "application/json", + "host": "stash.renovatebot.com", + "user-agent": "https://github.com/renovatebot/renovate", + "x-atlassian-token": "no-check", + }, + "method": "PUT", + "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5", + }, ] `; diff --git a/lib/platform/bitbucket-server/index.spec.ts b/lib/platform/bitbucket-server/index.spec.ts index a21c5e69be4111fe98ee9898639ad62528abb1ee..090ed692ba7e4eb9b9142d848f3afa110ac3eb23 100644 --- a/lib/platform/bitbucket-server/index.spec.ts +++ b/lib/platform/bitbucket-server/index.spec.ts @@ -1,4 +1,5 @@ -// TODO fix mocks +import nock from 'nock'; +import * as httpMock from '../../../test/httpMock'; import { REPOSITORY_CHANGED, REPOSITORY_DISABLED, @@ -6,45 +7,176 @@ import { } from '../../constants/error-messages'; import { PR_STATE_CLOSED, PR_STATE_OPEN } from '../../constants/pull-requests'; import { BranchStatus } from '../../types'; -import { GotApi, Platform, RepoParams } from '../common'; +import { Platform } from '../common'; import { Storage } from '../git/storage'; -import responses from './__fixtures__/responses'; + +function repoMock( + endpoint: URL | string, + projectKey: string, + repositorySlug: string +) { + const projectKeyLower = projectKey.toLowerCase(); + return { + slug: repositorySlug, + id: 13076, + name: repositorySlug, + scmId: 'git', + state: 'AVAILABLE', + statusMessage: 'Available', + forkable: true, + project: { + key: projectKey, + id: 2900, + name: `${repositorySlug}'s name`, + public: false, + type: 'NORMAL', + links: { + self: [ + { href: `https://stash.renovatebot.com/projects/${projectKey}` }, + ], + }, + }, + public: false, + links: { + clone: [ + { + href: `${endpoint}/scm/${projectKeyLower}/${repositorySlug}.git`, + name: 'http', + }, + { + href: `ssh://git@stash.renovatebot.com:7999/${projectKeyLower}/${repositorySlug}.git`, + name: 'ssh', + }, + ], + self: [ + { + href: `${endpoint}/projects/${projectKey}/repos/${repositorySlug}/browse`, + }, + ], + }, + }; +} + +function prMock(endpoint, projectKey, repositorySlug) { + return { + id: 5, + version: 1, + title: 'title', + description: '* Line 1\r\n* Line 2', + state: 'OPEN', + open: true, + closed: false, + createdDate: 1547853840016, + updatedDate: 1547853840016, + fromRef: { + id: 'refs/heads/userName1/pullRequest5', + displayId: 'userName1/pullRequest5', + latestCommit: '55efc02b2ab13a43a66cf705f5faacfcc6a762b4', + // Removed this with the idea it's not needed + // repository: {}, + }, + toRef: { + id: 'refs/heads/master', + displayId: 'master', + latestCommit: '0d9c7726c3d628b7e28af234595cfd20febdbf8e', + // Removed this with the idea it's not needed + // repository: {}, + }, + locked: false, + author: { + user: { + name: 'userName1', + emailAddress: 'userName1@renovatebot.com', + id: 144846, + displayName: 'Renovate Bot', + active: true, + slug: 'userName1', + type: 'NORMAL', + links: { + self: [{ href: `${endpoint}/users/userName1` }], + }, + }, + role: 'AUTHOR', + approved: false, + status: 'UNAPPROVED', + }, + reviewers: [ + { + user: { + name: 'userName2', + emailAddress: 'userName2@renovatebot.com', + id: 71155, + displayName: 'Renovate bot 2', + active: true, + slug: 'userName2', + type: 'NORMAL', + links: { + self: [{ href: `${endpoint}/users/userName2` }], + }, + }, + role: 'REVIEWER', + approved: false, + status: 'UNAPPROVED', + }, + ], + participants: [], + links: { + self: [ + { + href: `${endpoint}/projects/${projectKey}/repos/${repositorySlug}/pull-requests/5`, + }, + ], + }, + }; +} + +const scenarios = { + 'endpoint with no path': new URL('https://stash.renovatebot.com'), + 'endpoint with path': new URL('https://stash.renovatebot.com/vcs'), +}; describe('platform/bitbucket-server', () => { - Object.entries(responses).forEach(([scenarioName, mockResponses]) => { + Object.entries(scenarios).forEach(([scenarioName, url]) => { + const urlHost = url.origin; + const urlPath = url.pathname === '/' ? '' : url.pathname; + describe(scenarioName, () => { let bitbucket: Platform; - let api: jest.Mocked<GotApi>; let hostRules: jest.Mocked<typeof import('../../util/host-rules')>; let GitStorage: jest.Mock<Storage> & { getUrl: jest.MockInstance<any, any>; }; + + async function initRepo(config = {}): Promise<nock.Scope> { + const scope = httpMock + .scope(urlHost) + .get(`${urlPath}/rest/api/1.0/projects/SOME/repos/repo`) + .reply(200, repoMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/branches/default` + ) + .reply(200, { + displayId: 'master', + }); + await bitbucket.initRepo({ + endpoint: 'https://stash.renovatebot.com/vcs/', + repository: 'SOME/repo', + localDir: '', + optimizeForDisabled: false, + ...config, + }); + return scope; + } + beforeEach(async () => { // reset module jest.resetModules(); + httpMock.reset(); + httpMock.setup(); jest.mock('delay'); - jest.mock( - '../../util/got', - () => (url: string, options: { method: string }) => { - const { method } = options; - const body = mockResponses[url] && mockResponses[url][method]; - if (!body) { - return Promise.reject(new Error(`no match for ${method} ${url}`)); - } - if (body instanceof Promise) { - return body; - } - return Promise.resolve({ body }); - } - ); jest.mock('../git/storage'); jest.mock('../../util/host-rules'); hostRules = require('../../util/host-rules'); - api = require('./bb-got-wrapper').api; - jest.spyOn(api, 'get'); - jest.spyOn(api, 'post'); - jest.spyOn(api, 'put'); - jest.spyOn(api, 'delete'); bitbucket = await import('.'); GitStorage = require('../git/storage').Storage; GitStorage.mockImplementation( @@ -88,14 +220,6 @@ describe('platform/bitbucket-server', () => { await bitbucket.cleanRepo(); }); - function initRepo(config?: Partial<RepoParams>) { - return bitbucket.initRepo({ - endpoint: 'https://stash.renovatebot.com/vcs/', - repository: 'SOME/repo', - ...config, - } as any); - } - describe('initPlatform()', () => { it('should throw if no endpoint', () => { expect.assertions(1); @@ -121,100 +245,170 @@ describe('platform/bitbucket-server', () => { describe('getRepos()', () => { it('returns repos', async () => { expect.assertions(2); + httpMock + .scope(urlHost) + .get( + `${urlPath}/rest/api/1.0/repos?permission=REPO_WRITE&state=AVAILABLE&limit=100` + ) + .reply(200, { + size: 1, + limit: 100, + isLastPage: true, + values: [repoMock(url, 'SOME', 'repo')], + start: 0, + }); expect(await bitbucket.getRepos()).toEqual(['some/repo']); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('initRepo()', () => { it('works', async () => { - expect.assertions(1); - const res = await initRepo(); - expect(res).toMatchSnapshot(); + expect.assertions(2); + httpMock + .scope(urlHost) + .get(`${urlPath}/rest/api/1.0/projects/SOME/repos/repo`) + .reply(200, repoMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/branches/default` + ) + .reply(200, { + displayId: 'master', + }); + expect( + await bitbucket.initRepo({ + endpoint: 'https://stash.renovatebot.com/vcs/', + repository: 'SOME/repo', + localDir: '', + optimizeForDisabled: false, + }) + ).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('does not throw', async () => { - expect.assertions(1); - api.get.mockResolvedValueOnce({ - body: { + expect.assertions(2); + httpMock + .scope(urlHost) + .get(`${urlPath}/rest/api/1.0/projects/SOME/repos/repo`) + .reply(200, repoMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/branches/default` + ) + .reply(200, { + displayId: 'master', + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/browse/renovate.json?limit=20000` + ) + .reply(200, { isLastPage: false, lines: ['{'], size: 50000, - }, - } as any); - - const res = await initRepo({ optimizeForDisabled: true }); + }); + const res = await bitbucket.initRepo({ + endpoint: 'https://stash.renovatebot.com/vcs/', + repository: 'SOME/repo', + localDir: '', + optimizeForDisabled: true, + }); expect(res).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('throws disabled', async () => { - expect.assertions(1); - api.get.mockResolvedValueOnce({ - body: { isLastPage: true, lines: ['{ "enabled": false }'] }, - } as any); - await expect(initRepo({ optimizeForDisabled: true })).rejects.toThrow( - REPOSITORY_DISABLED - ); + expect.assertions(2); + httpMock + .scope(urlHost) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/browse/renovate.json?limit=20000` + ) + .reply(200, { isLastPage: true, lines: ['{ "enabled": false }'] }); + await expect( + bitbucket.initRepo({ + endpoint: 'https://stash.renovatebot.com/vcs/', + repository: 'SOME/repo', + localDir: '', + optimizeForDisabled: true, + }) + ).rejects.toThrow(REPOSITORY_DISABLED); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('repoForceRebase()', () => { it('returns false on missing mergeConfig', async () => { - expect.assertions(1); - api.get.mockResolvedValueOnce({ - body: { + expect.assertions(2); + httpMock + .scope(urlHost) + .get( + `${urlPath}/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests` + ) + .reply(200, { mergeConfig: null, - }, - } as any); + }); const actual = await bitbucket.getRepoForceRebase(); expect(actual).toBe(false); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('returns false on missing defaultStrategy', async () => { - expect.assertions(1); - api.get.mockResolvedValueOnce({ - body: { + expect.assertions(2); + httpMock + .scope(urlHost) + .get( + `${urlPath}/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests` + ) + .reply(200, { mergeConfig: { defaultStrategy: null, }, - }, - } as any); + }); const actual = await bitbucket.getRepoForceRebase(); expect(actual).toBe(false); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it.each(['ff-only', 'rebase-ff-only', 'squash-ff-only'])( 'return true if %s strategy is enabled', async (id) => { - expect.assertions(1); - api.get.mockResolvedValueOnce({ - body: { + expect.assertions(2); + httpMock + .scope(urlHost) + .get( + `${urlPath}/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests` + ) + .reply(200, { mergeConfig: { defaultStrategy: { id, }, }, - }, - } as any); + }); const actual = await bitbucket.getRepoForceRebase(); expect(actual).toBe(true); + expect(httpMock.getTrace()).toMatchSnapshot(); } ); it.each(['no-ff', 'ff', 'rebase-no-ff', 'squash'])( 'return false if %s strategy is enabled', async (id) => { - expect.assertions(1); - api.get.mockResolvedValueOnce({ - body: { + expect.assertions(2); + httpMock + .scope(urlHost) + .get( + `${urlPath}/rest/api/1.0/projects/undefined/repos/undefined/settings/pull-requests` + ) + .reply(200, { mergeConfig: { defaultStrategy: { id, }, }, - }, - } as any); + }); const actual = await bitbucket.getRepoForceRebase(); expect(actual).toBe(false); + expect(httpMock.getTrace()).toMatchSnapshot(); } ); }); @@ -225,7 +419,7 @@ describe('platform/bitbucket-server', () => { await initRepo(); await bitbucket.setBaseBranch('branch'); await bitbucket.setBaseBranch(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -233,6 +427,7 @@ describe('platform/bitbucket-server', () => { it('sends to gitFs', async () => { await initRepo(); expect(await bitbucket.getFileList()).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -243,6 +438,7 @@ describe('platform/bitbucket-server', () => { expect( await bitbucket.branchExists(undefined as any) ).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); }); @@ -253,6 +449,7 @@ describe('platform/bitbucket-server', () => { expect( await bitbucket.isBranchStale(undefined as any) ).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -260,6 +457,7 @@ describe('platform/bitbucket-server', () => { it('sends to gitFs', async () => { await initRepo(); expect(await bitbucket.deleteBranch('branch')).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -267,19 +465,28 @@ describe('platform/bitbucket-server', () => { it('sends to gitFs', async () => { await initRepo(); expect(await bitbucket.mergeBranch('branch')).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('commitFiles()', () => { it('sends to gitFs', async () => { expect.assertions(1); - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100` + ) + .reply(200, { + isLastPage: true, + values: [prMock(url, 'SOME', 'repo')], + }); await bitbucket.commitFiles({ branchName: 'some-branch', files: [{ name: 'test', contents: 'dummy' }], message: 'message', }); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -287,6 +494,7 @@ describe('platform/bitbucket-server', () => { it('sends to gitFs', async () => { await initRepo(); expect(await bitbucket.getFile('', '')).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -294,6 +502,7 @@ describe('platform/bitbucket-server', () => { it('sends to gitFs', async () => { await initRepo(); expect(await bitbucket.getAllRenovateBranches('')).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -301,6 +510,7 @@ describe('platform/bitbucket-server', () => { it('sends to gitFs', async () => { await initRepo(); expect(await bitbucket.getBranchLastCommitTime('')).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -312,71 +522,176 @@ describe('platform/bitbucket-server', () => { describe('addReviewers', () => { it('does not throw', async () => { - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .twice() + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .twice() + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .twice() + .reply(200, prMock(url, 'SOME', 'repo')) + .put( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')); + expect(await bitbucket.addReviewers(5, ['name'])).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('sends the reviewer name as a reviewer', async () => { - expect.assertions(3); - await initRepo(); + expect.assertions(1); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .twice() + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .twice() + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .twice() + .reply(200, prMock(url, 'SOME', 'repo')) + .put( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')); + await bitbucket.addReviewers(5, ['name']); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.put.mock.calls).toMatchSnapshot(); - expect(api.post.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('throws not-found', async () => { - expect.assertions(5); + it('throws not-found 1', async () => { await initRepo(); - await expect( bitbucket.addReviewers(null as any, ['name']) ).rejects.toThrow(REPOSITORY_NOT_FOUND); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + + it('throws not-found 2', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/4` + ) + .reply(404); + await expect(bitbucket.addReviewers(4, ['name'])).rejects.toThrow( REPOSITORY_NOT_FOUND ); - api.put.mockReturnValueOnce( - Promise.reject({ - statusCode: 404, + + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + + it('throws not-found 3', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], }) - ); + .put( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(404); + await expect(bitbucket.addReviewers(5, ['name'])).rejects.toThrow( REPOSITORY_NOT_FOUND ); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.put.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('throws repository-changed', async () => { - expect.assertions(3); - await initRepo(); - api.put.mockReturnValueOnce( - Promise.reject({ - statusCode: 409, + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], }) - ); + .put( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(409); await expect(bitbucket.addReviewers(5, ['name'])).rejects.toThrow( REPOSITORY_CHANGED ); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.put.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('throws', async () => { - expect.assertions(3); - await initRepo(); - api.put.mockReturnValueOnce( - Promise.reject({ - statusCode: 405, + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], }) - ); - await expect(bitbucket.addReviewers(5, ['name'])).rejects.toEqual({ + .put( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(405); + await expect( + bitbucket.addReviewers(5, ['name']) + ).rejects.toMatchObject({ statusCode: 405, }); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.put.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -388,21 +703,54 @@ describe('platform/bitbucket-server', () => { describe('ensureComment()', () => { it('does not throw', async () => { - expect.assertions(2); - expect( - await bitbucket.ensureComment({ - number: 3, - topic: 'topic', - content: 'content', - }) - ).toBe(false); - expect(api.get.mock.calls).toMatchSnapshot(); + httpMock + .scope(urlHost) + .get( + `${urlPath}/rest/api/1.0/projects/undefined/repos/undefined/pull-requests/3/activities?limit=100` + ) + .reply(200); + const res = await bitbucket.ensureComment({ + number: 3, + topic: 'topic', + content: 'content', + }); + expect(res).toBe(false); + expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('add comment if not found', async () => { - expect.assertions(6); - await initRepo(); - api.get.mockClear(); + it('add comment if not found 1', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100` + ) + .reply(200, { + isLastPage: false, + nextPageStart: 1, + values: [ + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 21, text: '### some-subject\n\nblablabla' }, + }, + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 22, text: '!merge' }, + }, + ], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1` + ) + .reply(200, { + isLastPage: true, + values: [{ action: 'OTHER' }], + }) + .post( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments` + ) + .reply(200); expect( await bitbucket.ensureComment({ @@ -411,11 +759,42 @@ describe('platform/bitbucket-server', () => { content: 'content', }) ).toBe(true); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post).toHaveBeenCalledTimes(1); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); - api.get.mockClear(); - api.post.mockClear(); + it('add comment if not found 2', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100` + ) + .reply(200, { + isLastPage: false, + nextPageStart: 1, + values: [ + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 21, text: '### some-subject\n\nblablabla' }, + }, + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 22, text: '!merge' }, + }, + ], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1` + ) + .reply(200, { + isLastPage: true, + values: [{ action: 'OTHER' }], + }) + .post( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments` + ) + .reply(200); expect( await bitbucket.ensureComment({ @@ -424,14 +803,48 @@ describe('platform/bitbucket-server', () => { content: 'content', }) ).toBe(true); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post).toHaveBeenCalledTimes(1); + expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('add updates comment if necessary', async () => { - expect.assertions(8); - await initRepo(); - api.get.mockClear(); + it('add updates comment if necessary 1', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100` + ) + .reply(200, { + isLastPage: false, + nextPageStart: 1, + values: [ + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 21, text: '### some-subject\n\nblablabla' }, + }, + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 22, text: '!merge' }, + }, + ], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1` + ) + .reply(200, { + isLastPage: true, + values: [{ action: 'OTHER' }], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21` + ) + .reply(200, { + version: 1, + }) + .put( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21` + ) + .reply(200); expect( await bitbucket.ensureComment({ @@ -440,12 +853,42 @@ describe('platform/bitbucket-server', () => { content: 'some\ncontent', }) ).toBe(true); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post).toHaveBeenCalledTimes(0); - expect(api.put).toHaveBeenCalledTimes(1); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); - api.get.mockClear(); - api.put.mockClear(); + it('add updates comment if necessary 2', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100` + ) + .reply(200, { + isLastPage: false, + nextPageStart: 1, + values: [ + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 21, text: '### some-subject\n\nblablabla' }, + }, + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 22, text: '!merge' }, + }, + ], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1` + ) + .reply(200, { + isLastPage: true, + values: [{ action: 'OTHER' }], + }) + .post( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments` + ) + .reply(200); expect( await bitbucket.ensureComment({ @@ -454,15 +897,38 @@ describe('platform/bitbucket-server', () => { content: 'some\ncontent', }) ).toBe(true); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post).toHaveBeenCalledTimes(1); - expect(api.put).toHaveBeenCalledTimes(0); + expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('skips comment', async () => { - expect.assertions(6); - await initRepo(); - api.get.mockClear(); + it('skips comment 1', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100` + ) + .reply(200, { + isLastPage: false, + nextPageStart: 1, + values: [ + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 21, text: '### some-subject\n\nblablabla' }, + }, + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 22, text: '!merge' }, + }, + ], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1` + ) + .reply(200, { + isLastPage: true, + values: [{ action: 'OTHER' }], + }); expect( await bitbucket.ensureComment({ @@ -471,100 +937,293 @@ describe('platform/bitbucket-server', () => { content: 'blablabla', }) ).toBe(true); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.put).toHaveBeenCalledTimes(0); - - api.get.mockClear(); - api.put.mockClear(); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); - expect( - await bitbucket.ensureComment({ - number: 5, - topic: null, - content: '!merge', + it('skips comment 2', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100` + ) + .reply(200, { + isLastPage: false, + nextPageStart: 1, + values: [ + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 21, text: '### some-subject\n\nblablabla' }, + }, + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 22, text: '!merge' }, + }, + ], }) - ).toBe(true); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.put).toHaveBeenCalledTimes(0); + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1` + ) + .reply(200, { + isLastPage: true, + values: [{ action: 'OTHER' }], + }); + + const res = await bitbucket.ensureComment({ + number: 5, + topic: null, + content: '!merge', + }); + httpMock.getTrace(); + expect(res).toBe(true); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('ensureCommentRemoval()', () => { it('does not throw', async () => { - expect.assertions(1); + httpMock + .scope(urlHost) + .get( + `${urlPath}/rest/api/1.0/projects/undefined/repos/undefined/pull-requests/5/activities?limit=100` + ) + .reply(200, { + isLastPage: false, + nextPageStart: 1, + values: [ + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 21, text: '### some-subject\n\nblablabla' }, + }, + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 22, text: '!merge' }, + }, + ], + }) + .get( + `${urlPath}/rest/api/1.0/projects/undefined/repos/undefined/pull-requests/5/activities?limit=100&start=1` + ) + .reply(200, { + isLastPage: true, + values: [{ action: 'OTHER' }], + }); await bitbucket.ensureCommentRemoval({ number: 5, topic: 'topic' }); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('deletes comment by topic if found', async () => { - expect.assertions(2); - await initRepo(); - api.get.mockClear(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100` + ) + .reply(200, { + isLastPage: false, + nextPageStart: 1, + values: [ + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 21, text: '### some-subject\n\nblablabla' }, + }, + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 22, text: '!merge' }, + }, + ], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1` + ) + .reply(200, { + isLastPage: true, + values: [{ action: 'OTHER' }], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21` + ) + .reply(200, { + version: 1, + }) + .delete( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/21?version=1` + ) + .reply(200); await bitbucket.ensureCommentRemoval({ number: 5, topic: 'some-subject', }); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.delete).toHaveBeenCalledTimes(1); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('deletes comment by content if found', async () => { - expect.assertions(2); - await initRepo(); - api.get.mockClear(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100` + ) + .reply(200, { + isLastPage: false, + nextPageStart: 1, + values: [ + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 21, text: '### some-subject\n\nblablabla' }, + }, + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 22, text: '!merge' }, + }, + ], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1` + ) + .reply(200, { + isLastPage: true, + values: [{ action: 'OTHER' }], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/22` + ) + .reply(200, { + version: 1, + }) + .delete( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/comments/22?version=1` + ) + .reply(200); await bitbucket.ensureCommentRemoval({ number: 5, content: '!merge', }); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.delete).toHaveBeenCalledTimes(1); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('deletes nothing', async () => { - expect.assertions(2); - await initRepo(); - api.get.mockClear(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100` + ) + .reply(200, { + isLastPage: false, + nextPageStart: 1, + values: [ + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 21, text: '### some-subject\n\nblablabla' }, + }, + { + action: 'COMMENTED', + commentAction: 'ADDED', + comment: { id: 22, text: '!merge' }, + }, + ], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/activities?limit=100&start=1` + ) + .reply(200, { + isLastPage: true, + values: [{ action: 'OTHER' }], + }); await bitbucket.ensureCommentRemoval({ number: 5, topic: 'topic' }); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.delete).toHaveBeenCalledTimes(0); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('getPrList()', () => { it('has pr', async () => { - expect.assertions(2); - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100` + ) + .reply(200, { + isLastPage: true, + values: [prMock(url, 'SOME', 'repo')], + }); expect(await bitbucket.getPrList()).toMatchSnapshot(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('getBranchPr()', () => { it('has pr', async () => { - expect.assertions(2); - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100` + ) + .reply(200, { + isLastPage: true, + values: [prMock(url, 'SOME', 'repo')], + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], + }); + expect( await bitbucket.getBranchPr('userName1/pullRequest5') ).toMatchSnapshot(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('has no pr', async () => { - expect.assertions(2); - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100` + ) + .reply(200, { + isLastPage: true, + values: [prMock(url, 'SOME', 'repo')], + }); + expect( - await bitbucket.findPr({ branchName: 'userName1/pullRequest1' }) + await bitbucket.findPr({ + branchName: 'userName1/pullRequest1', + }) ).toBeUndefined(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('findPr()', () => { it('has pr', async () => { - expect.assertions(2); - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100` + ) + .reply(200, { + isLastPage: true, + values: [prMock(url, 'SOME', 'repo')], + }); + expect( await bitbucket.findPr({ branchName: 'userName1/pullRequest5', @@ -572,11 +1231,19 @@ describe('platform/bitbucket-server', () => { state: PR_STATE_OPEN, }) ).toMatchSnapshot(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('has no pr', async () => { - expect.assertions(2); - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests?state=ALL&role.1=AUTHOR&username.1=abc&limit=100` + ) + .reply(200, { + isLastPage: true, + values: [prMock(url, 'SOME', 'repo')], + }); + expect( await bitbucket.findPr({ branchName: 'userName1/pullRequest5', @@ -584,27 +1251,48 @@ describe('platform/bitbucket-server', () => { state: PR_STATE_CLOSED, }) ).toBeUndefined(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('createPr()', () => { it('posts PR', async () => { - expect.assertions(3); - await initRepo(); + const scope = await initRepo(); + scope + .get(`${urlPath}/rest/api/1.0/projects/SOME/repos/repo`) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=5&targetRepoId=5` + ) + .reply(200, [{ name: 'jcitizen' }]) + .post( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests` + ) + .reply(200, prMock(url, 'SOME', 'repo')); + const { number: id } = await bitbucket.createPr({ branchName: 'branch', prTitle: 'title', prBody: 'body', }); expect(id).toBe(5); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('posts PR default branch', async () => { - expect.assertions(3); - await initRepo(); + const scope = await initRepo(); + scope + .get(`${urlPath}/rest/api/1.0/projects/SOME/repos/repo`) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/default-reviewers/1.0/projects/SOME/repos/repo/reviewers?sourceRefId=refs/heads/branch&targetRefId=refs/heads/master&sourceRepoId=5&targetRepoId=5` + ) + .reply(200, [{ name: 'jcitizen' }]) + .post( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests` + ) + .reply(200, prMock(url, 'SOME', 'repo')); + const { number: id } = await bitbucket.createPr({ branchName: 'branch', prTitle: 'title', @@ -613,27 +1301,75 @@ describe('platform/bitbucket-server', () => { useDefaultBranch: true, }); expect(id).toBe(5); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('getPr()', () => { it('returns null for no prNo', async () => { - expect.assertions(2); + httpMock.scope(urlHost); expect(await bitbucket.getPr(undefined as any)).toBeNull(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('gets a PR', async () => { - expect.assertions(2); - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], + }); + expect(await bitbucket.getPr(5)).toMatchSnapshot(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('canRebase', async () => { - expect.assertions(4); - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/3/commits?withCounts=true` + ) + .reply(200, { + totalCount: 2, + }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .twice() + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .twice() + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .twice() + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], + }); + const author = global.gitAuthor; try { expect(await bitbucket.getPr(3)).toMatchSnapshot(); @@ -644,149 +1380,304 @@ describe('platform/bitbucket-server', () => { global.gitAuthor = { email: 'jane@example.com', name: 'jane' }; expect(await bitbucket.getPr(5)).toMatchSnapshot(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); } finally { global.gitAuthor = author; } }); it('gets a closed PR', async () => { - expect.assertions(2); - await initRepo(); - api.get.mockReturnValueOnce({ - body: { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, { version: 0, number: 5, state: 'MERGED', reviewers: [], fromRef: {}, toRef: {}, - }, - } as any); + }); + expect(await bitbucket.getPr(5)).toMatchSnapshot(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('updatePr()', () => { it('puts PR', async () => { - expect.assertions(2); - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], + }) + .put( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200); + await bitbucket.updatePr(5, 'title', 'body'); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.put.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('throws not-found', async () => { - expect.assertions(5); + it('throws not-found 1', async () => { await initRepo(); - await expect( bitbucket.updatePr(null as any, 'title', 'body') ).rejects.toThrow(REPOSITORY_NOT_FOUND); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + + it('throws not-found 2', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/4` + ) + .reply(404); await expect(bitbucket.updatePr(4, 'title', 'body')).rejects.toThrow( REPOSITORY_NOT_FOUND ); - api.put.mockReturnValueOnce( - Promise.reject({ - statusCode: 404, + + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + + it('throws not-found 3', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], }) - ); + .put( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(404); + await expect(bitbucket.updatePr(5, 'title', 'body')).rejects.toThrow( REPOSITORY_NOT_FOUND ); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.put.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('throws repository-changed', async () => { - expect.assertions(3); - await initRepo(); - api.put.mockReturnValueOnce( - Promise.reject({ - statusCode: 409, + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], }) - ); + .put( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(409); + await expect(bitbucket.updatePr(5, 'title', 'body')).rejects.toThrow( REPOSITORY_CHANGED ); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.put.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('throws', async () => { - expect.assertions(3); - await initRepo(); - api.put.mockReturnValueOnce( - Promise.reject({ - statusCode: 405, + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], }) - ); - await expect(bitbucket.updatePr(5, 'title', 'body')).rejects.toEqual({ + .put( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(405); + + await expect( + bitbucket.updatePr(5, 'title', 'body') + ).rejects.toMatchObject({ statusCode: 405, }); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.put.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('mergePr()', () => { it('posts Merge', async () => { - expect.assertions(3); - await initRepo(); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], + }) + .post( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1` + ) + .reply(200); + expect(await bitbucket.mergePr(5, 'branch')).toBe(true); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); - it('throws not-found', async () => { - expect.assertions(5); + it('throws not-found 1', async () => { await initRepo(); + const res = bitbucket.mergePr(null as any, 'branch'); + await expect(res).rejects.toThrow(REPOSITORY_NOT_FOUND); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + + it('throws not-found 2', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/4` + ) + .reply(404); - await expect( - bitbucket.mergePr(null as any, 'branch') - ).rejects.toThrow(REPOSITORY_NOT_FOUND); await expect(bitbucket.mergePr(4, 'branch')).rejects.toThrow( REPOSITORY_NOT_FOUND ); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); - api.post.mockReturnValueOnce( - Promise.reject({ - statusCode: 404, + it('throws not-found 3', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], }) - ); + .post( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1` + ) + .reply(404); await expect(bitbucket.mergePr(5, 'branch')).rejects.toThrow( REPOSITORY_NOT_FOUND ); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('throws conflicted', async () => { - expect.assertions(3); - await initRepo(); - api.post.mockRejectedValueOnce({ - statusCode: 409, - }); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], + }) + .post( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1` + ) + .reply(409); + expect(await bitbucket.mergePr(5, 'branch')).toBeFalsy(); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('unknown error', async () => { - expect.assertions(3); - await initRepo(); - api.post.mockReturnValueOnce( - Promise.reject({ - statusCode: 405, + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5` + ) + .reply(200, prMock(url, 'SOME', 'repo')) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge` + ) + .reply(200, { conflicted: false }) + .get( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/commits?withCounts=true` + ) + .reply(200, { + totalCount: 1, + values: [{ author: { emailAddress: 'bot@renovateapp.com' } }], }) - ); + .post( + `${urlPath}/rest/api/1.0/projects/SOME/repos/repo/pull-requests/5/merge?version=1` + ) + .reply(405); + await expect(bitbucket.mergePr(5, 'branch')).resolves.toBe(false); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -819,6 +1710,7 @@ Followed by some information. it('sends to gitFs', async () => { await initRepo(); expect(await bitbucket.getCommitMessages()).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); @@ -831,86 +1723,91 @@ Followed by some information. describe('getBranchStatus()', () => { it('should be success', async () => { - expect.assertions(3); - await initRepo(); - api.get.mockReturnValueOnce({ - body: { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200, { successful: 3, inProgress: 0, failed: 0, - }, - } as any); + }); - await expect( - bitbucket.getBranchStatus('somebranch', []) - ).resolves.toEqual(BranchStatus.green); + expect(await bitbucket.getBranchStatus('somebranch', [])).toEqual( + BranchStatus.green + ); - await expect( - bitbucket.getBranchStatus('somebranch') - ).resolves.toEqual(BranchStatus.green); + expect(await bitbucket.getBranchStatus('somebranch')).toEqual( + BranchStatus.green + ); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('should be pending', async () => { - expect.assertions(3); - await initRepo(); - api.get.mockReturnValueOnce({ - body: { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200, { successful: 3, inProgress: 1, failed: 0, - }, - } as any); + }); - await expect( - bitbucket.getBranchStatus('somebranch', []) - ).resolves.toEqual(BranchStatus.yellow); + expect(await bitbucket.getBranchStatus('somebranch', [])).toEqual( + BranchStatus.yellow + ); - api.get.mockReturnValueOnce({ - body: { + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200, { successful: 0, inProgress: 0, failed: 0, - }, - } as any); + }); - await expect( - bitbucket.getBranchStatus('somebranch', []) - ).resolves.toEqual(BranchStatus.yellow); + expect(await bitbucket.getBranchStatus('somebranch', [])).toEqual( + BranchStatus.yellow + ); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('should be failed', async () => { - expect.assertions(3); - await initRepo(); - - api.get.mockReturnValueOnce({ - body: { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200, { successful: 1, inProgress: 1, failed: 1, - }, - } as any); + }); - await expect( - bitbucket.getBranchStatus('somebranch', []) - ).resolves.toEqual(BranchStatus.red); + expect(await bitbucket.getBranchStatus('somebranch', [])).toEqual( + BranchStatus.red + ); - api.get.mockImplementationOnce(() => { - throw new Error('requst-failed'); - }); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .replyWithError('requst-failed'); - await expect( - bitbucket.getBranchStatus('somebranch', []) - ).resolves.toEqual(BranchStatus.red); + expect(await bitbucket.getBranchStatus('somebranch', [])).toEqual( + BranchStatus.red + ); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('throws repository-changed', async () => { - expect.assertions(1); GitStorage.mockImplementationOnce( () => ({ @@ -919,19 +1816,23 @@ Followed by some information. cleanRepo: jest.fn(), } as any) ); + await initRepo(); await expect( bitbucket.getBranchStatus('somebranch', []) ).rejects.toThrow(REPOSITORY_CHANGED); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('getBranchStatusCheck()', () => { it('should be success', async () => { - expect.assertions(2); - await initRepo(); - api.get.mockReturnValueOnce({ - body: { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .reply(200, { isLastPage: true, values: [ { @@ -940,21 +1841,22 @@ Followed by some information. url: 'https://renovatebot.com', }, ], - }, - } as any); + }); - await expect( - bitbucket.getBranchStatusCheck('somebranch', 'context-2') - ).resolves.toEqual(BranchStatus.green); + expect( + await bitbucket.getBranchStatusCheck('somebranch', 'context-2') + ).toEqual(BranchStatus.green); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('should be pending', async () => { - expect.assertions(2); - await initRepo(); - api.get.mockReturnValueOnce({ - body: { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .reply(200, { isLastPage: true, values: [ { @@ -963,21 +1865,22 @@ Followed by some information. url: 'https://renovatebot.com', }, ], - }, - } as any); + }); - await expect( - bitbucket.getBranchStatusCheck('somebranch', 'context-2') - ).resolves.toEqual(BranchStatus.yellow); + expect( + await bitbucket.getBranchStatusCheck('somebranch', 'context-2') + ).toEqual(BranchStatus.yellow); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('should be failure', async () => { - expect.assertions(2); - await initRepo(); - api.get.mockReturnValueOnce({ - body: { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .reply(200, { isLastPage: true, values: [ { @@ -986,47 +1889,64 @@ Followed by some information. url: 'https://renovatebot.com', }, ], - }, - } as any); + }); - await expect( - bitbucket.getBranchStatusCheck('somebranch', 'context-2') - ).resolves.toEqual(BranchStatus.red); + expect( + await bitbucket.getBranchStatusCheck('somebranch', 'context-2') + ).toEqual(BranchStatus.red); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); it('should be null', async () => { - expect.assertions(3); - await initRepo(); - api.get.mockImplementationOnce(() => { - throw new Error('requst-failed'); - }); + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .replyWithError('requst-failed'); - await expect( - bitbucket.getBranchStatusCheck('somebranch', 'context-2') - ).resolves.toBeNull(); + expect( + await bitbucket.getBranchStatusCheck('somebranch', 'context-2') + ).toBeNull(); - api.get.mockReturnValueOnce({ - body: { + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .reply(200, { isLastPage: true, values: [], - }, - } as any); + }); - await expect( - bitbucket.getBranchStatusCheck('somebranch', 'context-2') - ).resolves.toBeNull(); + expect( + await bitbucket.getBranchStatusCheck('somebranch', 'context-2') + ).toBeNull(); - expect(api.get.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); describe('setBranchStatus()', () => { - it('should be success', async () => { - expect.assertions(2); - await initRepo(); - api.get.mockClear(); + it('should be success 1', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .twice() + .reply(200, { + isLastPage: true, + values: [{ key: 'context-1', state: 'SUCCESSFUL' }], + }) + .post( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200) + .get( + `${urlPath}/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200, {}); await bitbucket.setBranchStatus({ branchName: 'somebranch', @@ -1035,6 +1955,28 @@ Followed by some information. state: BranchStatus.green, }); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + it('should be success 2', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .twice() + .reply(200, { + isLastPage: true, + values: [{ key: 'context-1', state: 'SUCCESSFUL' }], + }) + .post( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200) + .get( + `${urlPath}/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200, {}); + await bitbucket.setBranchStatus({ branchName: 'somebranch', context: 'context-2', @@ -1042,6 +1984,28 @@ Followed by some information. state: BranchStatus.red, }); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + it('should be success 3', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .twice() + .reply(200, { + isLastPage: true, + values: [{ key: 'context-1', state: 'SUCCESSFUL' }], + }) + .post( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200) + .get( + `${urlPath}/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200, {}); + await bitbucket.setBranchStatus({ branchName: 'somebranch', context: 'context-2', @@ -1049,6 +2013,28 @@ Followed by some information. state: BranchStatus.red, }); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + it('should be success 4', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .twice() + .reply(200, { + isLastPage: true, + values: [{ key: 'context-1', state: 'SUCCESSFUL' }], + }) + .post( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200) + .get( + `${urlPath}/rest/build-status/1.0/commits/stats/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .reply(200, {}); + await bitbucket.setBranchStatus({ branchName: 'somebranch', context: 'context-2', @@ -1056,9 +2042,22 @@ Followed by some information. state: BranchStatus.yellow, }); - api.post.mockImplementationOnce(() => { - throw new Error('requst-failed'); - }); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + it('should be success 5', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .reply(200, { + isLastPage: true, + values: [{ key: 'context-1', state: 'SUCCESSFUL' }], + }) + .post( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e` + ) + .replyWithError('requst-failed'); await bitbucket.setBranchStatus({ branchName: 'somebranch', @@ -1067,6 +2066,19 @@ Followed by some information. state: BranchStatus.green, }); + expect(httpMock.getTrace()).toMatchSnapshot(); + }); + it('should be success 6', async () => { + const scope = await initRepo(); + scope + .get( + `${urlPath}/rest/build-status/1.0/commits/0d9c7726c3d628b7e28af234595cfd20febdbf8e?limit=100` + ) + .reply(200, { + isLastPage: true, + values: [{ key: 'context-1', state: 'SUCCESSFUL' }], + }); + await bitbucket.setBranchStatus({ branchName: 'somebranch', context: 'context-1', @@ -1074,8 +2086,7 @@ Followed by some information. state: BranchStatus.green, }); - expect(api.get.mock.calls).toMatchSnapshot(); - expect(api.post.mock.calls).toMatchSnapshot(); + expect(httpMock.getTrace()).toMatchSnapshot(); }); }); });