Introduce AllUsersPage test

pull/3001/head
Andrew Watkins 2018-03-15 16:44:18 -07:00
parent 7a8b750122
commit 37f3043dee
2 changed files with 90 additions and 10 deletions

View File

@ -0,0 +1,49 @@
import React from 'react'
import {AllUsersPage} from 'src/admin/containers/chronograf/AllUsersPage'
import {shallow} from 'enzyme'
import {authLinks as links} from 'test/resources'
const noop = () => {}
const setup = (override = {}) => {
const props = {
links,
meID: '1',
users: [],
organizations: [],
actionsAdmin: {
loadUsersAsync: noop,
loadOrganizationsAsync: noop,
createUserAsync: noop,
updateUserAsync: noop,
deleteUserAsync: noop,
},
actionsConfig: {
getAuthConfigAsync: noop,
updateAuthConfigAsync: noop,
},
authConfig: {
superAdminNewUsers: false,
},
notify: noop,
...override,
}
const wrapper = shallow(<AllUsersPage {...props} />)
return {
wrapper,
props,
}
}
describe('Admin.Containers.Chronograf.AllUsersPage', () => {
describe('rendering', () => {
it('renders', () => {
const {wrapper} = setup()
expect(wrapper.exists()).toBe(true)
})
})
})

View File

@ -1,3 +1,14 @@
export const links = {
self: '/chronograf/v1/sources/16',
kapacitors: '/chronograf/v1/sources/16/kapacitors',
proxy: '/chronograf/v1/sources/16/proxy',
queries: '/chronograf/v1/sources/16/queries',
write: '/chronograf/v1/sources/16/write',
permissions: '/chronograf/v1/sources/16/permissions',
users: '/chronograf/v1/sources/16/users',
databases: '/chronograf/v1/sources/16/dbs',
}
export const source = {
id: '16',
name: 'ssl',
@ -9,16 +20,7 @@ export const source = {
telegraf: 'telegraf',
organization: '0',
role: 'viewer',
links: {
self: '/chronograf/v1/sources/16',
kapacitors: '/chronograf/v1/sources/16/kapacitors',
proxy: '/chronograf/v1/sources/16/proxy',
queries: '/chronograf/v1/sources/16/queries',
write: '/chronograf/v1/sources/16/write',
permissions: '/chronograf/v1/sources/16/permissions',
users: '/chronograf/v1/sources/16/users',
databases: '/chronograf/v1/sources/16/dbs',
},
links,
}
export const query = {
@ -60,3 +62,32 @@ export const kapacitor = {
proxy: '/proxy/kapacitor/1',
},
}
export const authLinks = {
allUsers: '/chronograf/v1/users',
auth: [
{
callback: '/oauth/github/callback',
label: 'Github',
login: '/oauth/github/login',
logout: '/oauth/github/logout',
name: 'github',
},
],
config: {
auth: '/chronograf/v1/config/auth',
self: '/chronograf/v1/config',
},
dashboards: '/chronograf/v1/dashboards',
environment: '/chronograf/v1/env',
external: {
statusFeed: 'https://www.influxdata.com/feed/json',
},
layouts: '/chronograf/v1/layouts',
logout: '/oauth/logout',
mappings: '/chronograf/v1/mappings',
me: '/chronograf/v1/me',
organizations: '/chronograf/v1/organizations',
sources: '/chronograf/v1/sources',
users: '/chronograf/v1/organizations/default/users',
}