Skip to content

Commit

Permalink
Fix more Spaces API integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jportner committed Oct 13, 2021
1 parent 97f949f commit 5e0b244
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,35 +250,7 @@ export function resolveCopyToSpaceConflictsSuite(
{
statusCode: 403,
error: 'Forbidden',
message: 'Unable to bulk_get index-pattern',
},
],
},
} as CopyResponse);

// Query ES to ensure that nothing was copied
const [dashboard, visualization] = await getObjectsAtSpace(destination);
expect(dashboard.attributes.title).to.eql(
`This is the ${destination} test space CTS dashboard`
);
expect(visualization.attributes.title).to.eql(`CTS vis 3 from ${destination} space`);
};

const createExpectReadonlyAtSpaceWithReferencesResult =
(spaceId: string = DEFAULT_SPACE_ID) =>
async (resp: TestResponse) => {
const destination = getDestinationSpace(spaceId);

const result = resp.body as CopyResponse;
expect(result).to.eql({
[destination]: {
success: false,
successCount: 0,
errors: [
{
statusCode: 403,
error: 'Forbidden',
message: 'Unable to bulk_create visualization',
message: 'Unable to bulk_create index-pattern,visualization',
},
],
},
Expand Down Expand Up @@ -611,7 +583,6 @@ export function resolveCopyToSpaceConflictsSuite(
createExpectNonOverriddenResponseWithReferences,
createExpectNonOverriddenResponseWithoutReferences,
createExpectUnauthorizedAtSpaceWithReferencesResult,
createExpectReadonlyAtSpaceWithReferencesResult,
createExpectUnauthorizedAtSpaceWithoutReferencesResult,
createMultiNamespaceTestCases,
originSpaces: ['default', 'space_1'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default function resolveCopyToSpaceConflictsTestSuite({ getService }: Ftr
createExpectOverriddenResponseWithoutReferences,
expectRouteForbiddenResponse,
createExpectUnauthorizedAtSpaceWithReferencesResult,
createExpectReadonlyAtSpaceWithReferencesResult,
createExpectUnauthorizedAtSpaceWithoutReferencesResult,
createMultiNamespaceTestCases,
NON_EXISTENT_SPACE_ID,
Expand Down Expand Up @@ -122,11 +121,11 @@ export default function resolveCopyToSpaceConflictsTestSuite({ getService }: Ftr
tests: {
withReferencesNotOverwriting: {
statusCode: 200,
response: createExpectReadonlyAtSpaceWithReferencesResult(spaceId),
response: createExpectUnauthorizedAtSpaceWithReferencesResult(spaceId),
},
withReferencesOverwriting: {
statusCode: 200,
response: createExpectReadonlyAtSpaceWithReferencesResult(spaceId),
response: createExpectUnauthorizedAtSpaceWithReferencesResult(spaceId),
},
withoutReferencesOverwriting: {
statusCode: 200,
Expand Down

0 comments on commit 5e0b244

Please sign in to comment.