2020-11-24 15:15:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe JiraConnect::AppDescriptorController do
|
|
|
|
describe '#show' do
|
2021-10-27 15:23:28 +05:30
|
|
|
let(:descriptor) do
|
|
|
|
json_response.deep_symbolize_keys
|
|
|
|
end
|
|
|
|
|
|
|
|
let(:logo_url) { %r{\Ahttp://test\.host/assets/gitlab_logo-\h+\.png\z} }
|
|
|
|
|
|
|
|
let(:common_module_properties) do
|
|
|
|
{
|
|
|
|
homeUrl: 'https://gitlab.com',
|
|
|
|
logoUrl: logo_url,
|
|
|
|
documentationUrl: 'https://docs.gitlab.com/ee/integration/jira/'
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
it 'returns JSON app descriptor' do
|
|
|
|
get :show
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(:ok)
|
2021-10-27 15:23:28 +05:30
|
|
|
|
|
|
|
expect(descriptor).to include(
|
|
|
|
name: Atlassian::JiraConnect.app_name,
|
|
|
|
description: kind_of(String),
|
|
|
|
key: Atlassian::JiraConnect.app_key,
|
|
|
|
baseUrl: 'https://test.host/-/jira_connect',
|
|
|
|
lifecycle: {
|
|
|
|
installed: '/events/installed',
|
|
|
|
uninstalled: '/events/uninstalled'
|
|
|
|
},
|
|
|
|
vendor: {
|
|
|
|
name: 'GitLab',
|
|
|
|
url: 'https://gitlab.com'
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
2021-10-27 15:23:28 +05:30
|
|
|
links: {
|
|
|
|
documentation: 'http://test.host/help/integration/jira_development_panel#gitlabcom-1'
|
|
|
|
},
|
|
|
|
authentication: {
|
|
|
|
type: 'jwt'
|
|
|
|
},
|
|
|
|
scopes: %w(READ WRITE DELETE),
|
|
|
|
apiVersion: 1,
|
|
|
|
apiMigrations: {
|
|
|
|
'context-qsh': true,
|
2021-11-18 22:05:49 +05:30
|
|
|
gdpr: true,
|
|
|
|
'signed-install': true
|
2020-11-24 15:15:51 +05:30
|
|
|
}
|
|
|
|
)
|
2021-10-27 15:23:28 +05:30
|
|
|
|
|
|
|
expect(descriptor[:modules]).to include(
|
|
|
|
postInstallPage: {
|
|
|
|
key: 'gitlab-configuration',
|
|
|
|
name: { value: 'GitLab Configuration' },
|
|
|
|
url: '/subscriptions',
|
|
|
|
conditions: contain_exactly(
|
|
|
|
a_hash_including(condition: 'user_is_admin', invert: false)
|
|
|
|
)
|
|
|
|
},
|
|
|
|
jiraDevelopmentTool: {
|
|
|
|
actions: {
|
|
|
|
createBranch: {
|
|
|
|
templateUrl: 'http://test.host/-/jira_connect/branches/new?issue_key={issue.key}&issue_summary={issue.summary}'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
key: 'gitlab-development-tool',
|
|
|
|
application: { value: 'GitLab' },
|
|
|
|
name: { value: 'GitLab' },
|
|
|
|
url: 'https://gitlab.com',
|
|
|
|
logoUrl: logo_url,
|
|
|
|
capabilities: %w(branch commit pull_request)
|
|
|
|
},
|
|
|
|
jiraBuildInfoProvider: common_module_properties.merge(
|
|
|
|
actions: {},
|
|
|
|
name: { value: 'GitLab CI' },
|
|
|
|
key: 'gitlab-ci'
|
|
|
|
),
|
|
|
|
jiraDeploymentInfoProvider: common_module_properties.merge(
|
|
|
|
actions: {},
|
|
|
|
name: { value: 'GitLab Deployments' },
|
|
|
|
key: 'gitlab-deployments'
|
|
|
|
),
|
|
|
|
jiraFeatureFlagInfoProvider: common_module_properties.merge(
|
|
|
|
actions: {},
|
|
|
|
name: { value: 'GitLab Feature Flags' },
|
|
|
|
key: 'gitlab-feature-flags'
|
|
|
|
)
|
|
|
|
)
|
2020-11-24 15:15:51 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|