|
@@ -2,15 +2,6 @@ import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
|
|
|
|
|
|
import IntegrationDetailedView from 'sentry/views/settings/organizationIntegrations/integrationDetailedView';
|
|
|
|
|
|
-const mockResponse = mocks => {
|
|
|
- mocks.forEach(([url, body]) =>
|
|
|
- MockApiClient.addMockResponse({
|
|
|
- url,
|
|
|
- body,
|
|
|
- })
|
|
|
- );
|
|
|
-};
|
|
|
-
|
|
|
describe('IntegrationDetailedView', function () {
|
|
|
const org = TestStubs.Organization({
|
|
|
access: ['org:integrations', 'org:write'],
|
|
@@ -20,74 +11,74 @@ describe('IntegrationDetailedView', function () {
|
|
|
beforeEach(() => {
|
|
|
MockApiClient.clearMockResponses();
|
|
|
|
|
|
- mockResponse([
|
|
|
- [
|
|
|
- `/organizations/${org.slug}/config/integrations/?provider_key=bitbucket`,
|
|
|
- {
|
|
|
- providers: [
|
|
|
- {
|
|
|
- canAdd: true,
|
|
|
- canDisable: false,
|
|
|
- features: ['commits', 'issue-basic'],
|
|
|
- key: 'bitbucket',
|
|
|
-
|
|
|
- metadata: {
|
|
|
- aspects: {},
|
|
|
- author: 'The Sentry Team',
|
|
|
- description:
|
|
|
- 'Connect your Sentry organization to Bitbucket, enabling the following features:',
|
|
|
-
|
|
|
- features: [],
|
|
|
- issue_url:
|
|
|
- 'https://github.com/getsentry/sentry/issues/new?template=bug.yml&title=Bitbucket%20Integration:%20&labels=Component%3A%20Integrations',
|
|
|
- noun: 'Installation',
|
|
|
- source_url:
|
|
|
- 'https://github.com/getsentry/sentry/tree/master/src/sentry/integrations/bitbucket',
|
|
|
- },
|
|
|
- name: 'Bitbucket',
|
|
|
-
|
|
|
- setupDialog: {
|
|
|
- height: 600,
|
|
|
- url: '/organizations/sentry/integrations/bitbucket/setup/',
|
|
|
- width: 600,
|
|
|
- },
|
|
|
- slug: 'bitbucket',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- ],
|
|
|
- [
|
|
|
- `/organizations/${org.slug}/integrations/?provider_key=bitbucket&includeConfig=0`,
|
|
|
- [
|
|
|
+ MockApiClient.addMockResponse({
|
|
|
+ url: `/organizations/${org.slug}/config/integrations/?provider_key=bitbucket`,
|
|
|
+ body: {
|
|
|
+ providers: [
|
|
|
{
|
|
|
- accountType: null,
|
|
|
- configData: {},
|
|
|
- configOrganization: [],
|
|
|
- domainName: 'bitbucket.org/%7Bfb715533-bbd7-4666-aa57-01dc93dd9cc0%7D',
|
|
|
- icon: 'https://secure.gravatar.com/avatar/8b4cb68e40b74c90427d8262256bd1c8?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FNN-0.png',
|
|
|
- id: '4',
|
|
|
- name: '{fb715533-bbd7-4666-aa57-01dc93dd9cc0}',
|
|
|
- provider: {
|
|
|
+ canAdd: true,
|
|
|
+ canDisable: false,
|
|
|
+ features: ['commits', 'issue-basic'],
|
|
|
+ key: 'bitbucket',
|
|
|
+
|
|
|
+ metadata: {
|
|
|
aspects: {},
|
|
|
- canAdd: true,
|
|
|
- canDisable: false,
|
|
|
- features: ['commits', 'issue-basic'],
|
|
|
- key: 'bitbucket',
|
|
|
- name: 'Bitbucket',
|
|
|
- slug: 'bitbucket',
|
|
|
+ author: 'The Sentry Team',
|
|
|
+ description:
|
|
|
+ 'Connect your Sentry organization to Bitbucket, enabling the following features:',
|
|
|
+
|
|
|
+ features: [],
|
|
|
+ issue_url:
|
|
|
+ 'https://github.com/getsentry/sentry/issues/new?template=bug.yml&title=Bitbucket%20Integration:%20&labels=Component%3A%20Integrations',
|
|
|
+ noun: 'Installation',
|
|
|
+ source_url:
|
|
|
+ 'https://github.com/getsentry/sentry/tree/master/src/sentry/integrations/bitbucket',
|
|
|
+ },
|
|
|
+ name: 'Bitbucket',
|
|
|
+
|
|
|
+ setupDialog: {
|
|
|
+ height: 600,
|
|
|
+ url: '/organizations/sentry/integrations/bitbucket/setup/',
|
|
|
+ width: 600,
|
|
|
},
|
|
|
- status: 'active',
|
|
|
+ slug: 'bitbucket',
|
|
|
},
|
|
|
],
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ MockApiClient.addMockResponse({
|
|
|
+ url: `/organizations/${org.slug}/integrations/?provider_key=bitbucket&includeConfig=0`,
|
|
|
+ body: [
|
|
|
+ {
|
|
|
+ accountType: null,
|
|
|
+ configData: {},
|
|
|
+ configOrganization: [],
|
|
|
+ domainName: 'bitbucket.org/%7Bfb715533-bbd7-4666-aa57-01dc93dd9cc0%7D',
|
|
|
+ icon: 'https://secure.gravatar.com/avatar/8b4cb68e40b74c90427d8262256bd1c8?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FNN-0.png',
|
|
|
+ id: '4',
|
|
|
+ name: '{fb715533-bbd7-4666-aa57-01dc93dd9cc0}',
|
|
|
+ provider: {
|
|
|
+ aspects: {},
|
|
|
+ canAdd: true,
|
|
|
+ canDisable: false,
|
|
|
+ features: ['commits', 'issue-basic'],
|
|
|
+ key: 'bitbucket',
|
|
|
+ name: 'Bitbucket',
|
|
|
+ slug: 'bitbucket',
|
|
|
+ },
|
|
|
+ status: 'active',
|
|
|
+ },
|
|
|
],
|
|
|
- ]);
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
it('shows integration name, status, and install button', function () {
|
|
|
render(
|
|
|
<IntegrationDetailedView
|
|
|
- params={{integrationSlug: 'bitbucket', orgId: org.slug}}
|
|
|
- location={{query: {}}}
|
|
|
+ {...TestStubs.routeComponentProps()}
|
|
|
+ params={{integrationSlug: 'bitbucket'}}
|
|
|
+ location={TestStubs.location({query: {}})}
|
|
|
/>
|
|
|
);
|
|
|
expect(screen.getByText('Bitbucket')).toBeInTheDocument();
|
|
@@ -98,8 +89,9 @@ describe('IntegrationDetailedView', function () {
|
|
|
it('view configurations', function () {
|
|
|
render(
|
|
|
<IntegrationDetailedView
|
|
|
- params={{integrationSlug: 'bitbucket', orgId: org.slug}}
|
|
|
- location={{query: {tab: 'configurations'}}}
|
|
|
+ {...TestStubs.routeComponentProps()}
|
|
|
+ params={{integrationSlug: 'bitbucket'}}
|
|
|
+ location={TestStubs.location({query: {tab: 'configurations'}})}
|
|
|
/>
|
|
|
);
|
|
|
|
|
@@ -112,8 +104,9 @@ describe('IntegrationDetailedView', function () {
|
|
|
it('disables configure for members without access', function () {
|
|
|
render(
|
|
|
<IntegrationDetailedView
|
|
|
- params={{integrationSlug: 'bitbucket', orgId: org.slug}}
|
|
|
- location={{query: {tab: 'configurations'}}}
|
|
|
+ {...TestStubs.routeComponentProps()}
|
|
|
+ params={{integrationSlug: 'bitbucket'}}
|
|
|
+ location={TestStubs.location({query: {tab: 'configurations'}})}
|
|
|
/>,
|
|
|
{organization: TestStubs.Organization({access: ['org:read']})}
|
|
|
);
|
|
@@ -155,8 +148,9 @@ describe('IntegrationDetailedView', function () {
|
|
|
|
|
|
render(
|
|
|
<IntegrationDetailedView
|
|
|
- params={{integrationSlug: 'github', orgId: org.slug}}
|
|
|
- location={{query: {tab: 'configurations'}}}
|
|
|
+ {...TestStubs.routeComponentProps()}
|
|
|
+ params={{integrationSlug: 'github'}}
|
|
|
+ location={TestStubs.location({query: {tab: 'configurations'}})}
|
|
|
/>,
|
|
|
{organization: TestStubs.Organization({access: ['org:read']})}
|
|
|
);
|
|
@@ -198,9 +192,10 @@ describe('IntegrationDetailedView', function () {
|
|
|
|
|
|
render(
|
|
|
<IntegrationDetailedView
|
|
|
+ {...TestStubs.routeComponentProps()}
|
|
|
params={{integrationSlug: 'github'}}
|
|
|
organization={org}
|
|
|
- location={{query: {}}}
|
|
|
+ location={TestStubs.location({query: {}})}
|
|
|
/>
|
|
|
);
|
|
|
expect(screen.getByText('features')).toBeInTheDocument();
|
|
@@ -220,9 +215,10 @@ describe('IntegrationDetailedView', function () {
|
|
|
|
|
|
render(
|
|
|
<IntegrationDetailedView
|
|
|
+ {...TestStubs.routeComponentProps()}
|
|
|
params={{integrationSlug: 'github'}}
|
|
|
organization={org}
|
|
|
- location={{query: {}}}
|
|
|
+ location={TestStubs.location({query: {}})}
|
|
|
/>
|
|
|
);
|
|
|
|