Files
outline/server/test/factories.js
Tom Moor 83f32be6f7 Add missing authorization on views endpoints
Updated ApiKeys authorization to match elsewhere
2018-02-18 10:56:56 -08:00

34 lines
621 B
JavaScript

// @flow
import { Team, User } from '../models';
import uuid from 'uuid';
let count = 0;
export function buildTeam(overrides: Object = {}) {
count++;
return Team.create({
name: `Team ${count}`,
slackId: uuid.v4(),
...overrides,
});
}
export async function buildUser(overrides: Object = {}) {
count++;
if (!overrides.teamId) {
const team = await buildTeam();
overrides.teamId = team.id;
}
return User.create({
email: `user${count}@example.com`,
username: `user${count}`,
name: `User ${count}`,
password: 'test123!',
slackId: uuid.v4(),
...overrides,
});
}