fix: Match search requests from Slack using Integration for non-Slack teams (#1599)

* Match slack hook requests to integration
This commit is contained in:
Tom Moor
2020-10-21 08:53:38 -07:00
committed by GitHub
parent 15337b5bdf
commit b78e2f1e05
4 changed files with 120 additions and 13 deletions

View File

@@ -10,6 +10,8 @@ import {
Group,
GroupUser,
Attachment,
Authentication,
Integration,
} from "../models";
let count = 0;
@@ -68,6 +70,33 @@ export async function buildUser(overrides: Object = {}) {
});
}
export async function buildIntegration(overrides: Object = {}) {
if (!overrides.teamId) {
const team = await buildTeam();
overrides.teamId = team.id;
}
const user = await buildUser({ teamId: overrides.teamId });
const authentication = await Authentication.create({
service: "slack",
userId: user.id,
teamId: user.teamId,
token: "fake-access-token",
scopes: ["example", "scopes", "here"],
});
return Integration.create({
type: "post",
service: "slack",
settings: {
serviceTeamId: "slack_team_id",
},
authenticationId: authentication.id,
...overrides,
});
}
export async function buildCollection(overrides: Object = {}) {
count++;