Skip to content

Commit

Permalink
[Reporting] Rewrite addForceNowQuerystring to getFullUrls (#44851)
Browse files Browse the repository at this point in the history
* this is the one

* this could break a job nbd

* get_full_url to observe PNG and PDF job payload types

* fix typescripts

* fix ts in tests

* fix more types

* cosmetic

* remove PDF execute compatibility shim test -- that stuff is handled in now PDF executeJob

* fix unit test

* remove old strings

* Remove pdf execute compatibility shim entirely

* combine the 2 maps

* More reject matchers in the test
  • Loading branch information
tsullivan authored Sep 9, 2019
1 parent b90a0e3 commit ce30118
Show file tree
Hide file tree
Showing 22 changed files with 252 additions and 486 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ describe('headers', () => {
isImmediate: false,
savedObjectType: 'search',
},
relativeUrl: '/app/kibana#/something',
timeRange: {},
},
server: mockServer,
})
Expand All @@ -55,7 +53,6 @@ describe('headers', () => {
isImmediate: false,
savedObjectType: 'search',
},
relativeUrl: '/app/kibana#/something',
headers: encryptedHeaders,
},
server: mockServer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import { createMockServer } from '../../../test_helpers/create_mock_server';
import { getConditionalHeaders, getCustomLogo } from './index';
import { JobDocPayload } from '../../../types';
import { JobDocPayloadPDF } from '../../printable_pdf/types';

let mockServer: any;
beforeEach(() => {
Expand All @@ -26,15 +28,7 @@ describe('conditions', () => {
};

const { conditionalHeaders } = await getConditionalHeaders({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayload,
filteredHeaders: permittedHeaders,
server: mockServer,
});
Expand All @@ -51,15 +45,7 @@ describe('conditions', () => {
};

const { conditionalHeaders } = await getConditionalHeaders({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayload,
filteredHeaders: permittedHeaders,
server: mockServer,
});
Expand All @@ -80,15 +66,7 @@ describe('conditions', () => {
};

const { conditionalHeaders } = await getConditionalHeaders({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayload,
filteredHeaders: permittedHeaders,
server: mockServer,
});
Expand All @@ -105,15 +83,7 @@ describe('conditions', () => {
};

const { conditionalHeaders } = await getConditionalHeaders({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayload,
filteredHeaders: permittedHeaders,
server: mockServer,
});
Expand All @@ -128,15 +98,7 @@ describe('conditions', () => {
};

const { conditionalHeaders } = await getConditionalHeaders({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayload,
filteredHeaders: permittedHeaders,
server: mockServer,
});
Expand All @@ -159,15 +121,7 @@ describe('conditions', () => {
};

const { conditionalHeaders } = await getConditionalHeaders({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayload,
filteredHeaders: permittedHeaders,
server: mockServer,
});
Expand All @@ -184,15 +138,7 @@ describe('conditions', () => {
};

const { conditionalHeaders } = await getConditionalHeaders({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayload,
filteredHeaders: permittedHeaders,
server: mockServer,
});
Expand All @@ -208,15 +154,7 @@ test('uses basePath from job when creating saved object service', async () => {
};

const { conditionalHeaders } = await getConditionalHeaders({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayload,
filteredHeaders: permittedHeaders,
server: mockServer,
});
Expand All @@ -226,16 +164,7 @@ test('uses basePath from job when creating saved object service', async () => {

const jobBasePath = '/sbp/s/marketing';
await getCustomLogo({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
basePath: jobBasePath,
},
job: { basePath: jobBasePath } as JobDocPayloadPDF,
conditionalHeaders,
server: mockServer,
});
Expand All @@ -252,15 +181,7 @@ test(`uses basePath from server if job doesn't have a basePath when creating sav
};

const { conditionalHeaders } = await getConditionalHeaders({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayload,
filteredHeaders: permittedHeaders,
server: mockServer,
});
Expand All @@ -269,15 +190,7 @@ test(`uses basePath from server if job doesn't have a basePath when creating sav
mockServer.uiSettingsServiceFactory().get.mockReturnValue(logo);

await getCustomLogo({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayloadPDF,
conditionalHeaders,
server: mockServer,
});
Expand All @@ -291,15 +204,7 @@ describe('config formatting', () => {
test(`lowercases server.host`, async () => {
mockServer = createMockServer({ settings: { 'server.host': 'COOL-HOSTNAME' } });
const { conditionalHeaders } = await getConditionalHeaders({
job: {
title: 'cool-job-bro',
type: 'csv',
jobParams: {
savedObjectId: 'abc-123',
isImmediate: false,
savedObjectType: 'search',
},
},
job: {} as JobDocPayload,
filteredHeaders: {},
server: mockServer,
});
Expand Down
Loading

0 comments on commit ce30118

Please sign in to comment.