當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript SuperTest.put方法代碼示例

本文整理匯總了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);
 });
開發者ID:njd5475,項目名稱:kibana,代碼行數:13,代碼來源:update.ts

示例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);
 });
開發者ID:njd5475,項目名稱:kibana,代碼行數:16,代碼來源:update.ts

示例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'],
        },
      ],
//.........這裏部分代碼省略.........
開發者ID:,項目名稱:,代碼行數:101,代碼來源:

示例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'],
      },
    },
  });

//.........這裏部分代碼省略.........
開發者ID:njd5475,項目名稱:kibana,代碼行數:101,代碼來源:create_users_and_roles.ts


注:本文中的supertest.SuperTest.put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。