本文整理汇总了TypeScript中supertest.SuperTest.put方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SuperTest.put方法的具体用法?TypeScript SuperTest.put怎么用?TypeScript SuperTest.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类supertest.SuperTest
的用法示例。
在下文中一共展示了SuperTest.put方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it(`should return ${tests.newSpace.statusCode}`, async () => {
return supertest
.put(`${getUrlPrefix(spaceId)}/api/spaces/space/marketing`)
.auth(user.username, user.password)
.send({
name: 'marketing',
id: 'marketing',
description: 'a description',
color: '#5c5959',
})
.expect(tests.newSpace.statusCode)
.then(tests.newSpace.response);
});
示例2: it
it(`should return ${tests.doesntExist.statusCode}`, async () => {
await supertest
.put(
`${getUrlPrefix(spaceId)}/api/saved_objects/visualization/${getIdPrefix(
spaceId
)}not an id`
)
.auth(user.username, user.password)
.send({
attributes: {
title: 'My second favorite vis',
},
})
.expect(tests.doesntExist.statusCode)
.then(tests.doesntExist.response);
});
示例3: async
export const createUsersAndRoles = async (es: any, supertest: SuperTest<any>) => {
await supertest
.put('/api/security/role/kibana_legacy_user')
.send({
elasticsearch: {
indices: [
{
names: ['.kibana*'],
privileges: ['manage', 'read', 'index', 'delete'],
},
],
},
})
.expect(204);
await supertest
.put('/api/security/role/kibana_dual_privileges_user')
.send({
elasticsearch: {
indices: [
{
names: ['.kibana*'],
privileges: ['manage', 'read', 'index', 'delete'],
},
],
},
kibana: [
{
base: ['all'],
spaces: ['*'],
},
],
})
.expect(204);
await supertest
.put('/api/security/role/kibana_dual_privileges_dashboard_only_user')
.send({
elasticsearch: {
indices: [
{
names: ['.kibana*'],
privileges: ['read', 'view_index_metadata'],
},
],
},
kibana: [
{
base: ['read'],
spaces: ['*'],
},
],
})
.expect(204);
await supertest
.put('/api/security/role/kibana_rbac_user')
.send({
kibana: [
{
base: ['all'],
spaces: ['*'],
},
],
})
.expect(204);
await supertest
.put('/api/security/role/kibana_rbac_dashboard_only_user')
.send({
kibana: [
{
base: ['read'],
spaces: ['*'],
},
],
})
.expect(204);
await supertest
.put('/api/security/role/kibana_rbac_default_space_all_user')
.send({
kibana: [
{
base: ['all'],
spaces: ['default'],
},
],
})
.expect(204);
await supertest
.put('/api/security/role/kibana_rbac_default_space_read_user')
.send({
kibana: [
{
base: ['read'],
spaces: ['default'],
},
],
//.........这里部分代码省略.........
示例4: async
export const createUsersAndRoles = async (es: any, supertest: SuperTest<any>) => {
await supertest.put('/api/security/role/kibana_legacy_user').send({
elasticsearch: {
indices: [
{
names: ['.kibana*'],
privileges: ['manage', 'read', 'index', 'delete'],
},
],
},
});
await supertest.put('/api/security/role/kibana_dual_privileges_user').send({
elasticsearch: {
indices: [
{
names: ['.kibana*'],
privileges: ['manage', 'read', 'index', 'delete'],
},
],
},
kibana: {
global: ['all'],
},
});
await supertest.put('/api/security/role/kibana_dual_privileges_dashboard_only_user').send({
elasticsearch: {
indices: [
{
names: ['.kibana*'],
privileges: ['read', 'view_index_metadata'],
},
],
},
kibana: {
global: ['read'],
},
});
await supertest.put('/api/security/role/kibana_rbac_user').send({
kibana: {
global: ['all'],
},
});
await supertest.put('/api/security/role/kibana_rbac_dashboard_only_user').send({
kibana: {
global: ['read'],
},
});
await supertest.put('/api/security/role/kibana_rbac_default_space_all_user').send({
kibana: {
space: {
default: ['all'],
},
},
});
await supertest.put('/api/security/role/kibana_rbac_default_space_read_user').send({
kibana: {
space: {
default: ['read'],
},
},
});
await supertest.put('/api/security/role/kibana_rbac_space_1_all_user').send({
kibana: {
space: {
space_1: ['all'],
},
},
});
await supertest.put('/api/security/role/kibana_rbac_space_1_read_user').send({
kibana: {
space: {
space_1: ['read'],
},
},
});
await supertest.put('/api/security/role/kibana_rbac_space_2_all_user').send({
kibana: {
space: {
space_2: ['all'],
},
},
});
await supertest.put('/api/security/role/kibana_rbac_space_2_read_user').send({
kibana: {
space: {
space_2: ['read'],
},
},
});
//.........这里部分代码省略.........