本文整理匯總了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'],
},
},
});
//.........這裏部分代碼省略.........