本文整理汇总了TypeScript中models/auth_configs/spec/test_data.TestData.ldapAuthConfig方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestData.ldapAuthConfig方法的具体用法?TypeScript TestData.ldapAuthConfig怎么用?TypeScript TestData.ldapAuthConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models/auth_configs/spec/test_data.TestData
的用法示例。
在下文中一共展示了TestData.ldapAuthConfig方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should create a new auth config", () => {
jasmine.Ajax.stubRequest("/go/api/admin/security/auth_configs").andReturn(authConfigResponse());
AuthConfigsCRUD.create(AuthConfig.fromJSON(TestData.ldapAuthConfig()));
const request = jasmine.Ajax.requests.mostRecent();
expect(request.url).toEqual("/go/api/admin/security/auth_configs");
expect(request.method).toEqual("POST");
expect(request.data()).toEqual(toJSON(TestData.ldapAuthConfig()));
expect(request.requestHeaders.Accept).toEqual("application/vnd.go.cd.v1+json");
expect(request.requestHeaders["Content-Type"]).toEqual("application/json; charset=utf-8");
});
示例2: listAuthConfigResponse
function listAuthConfigResponse() {
return {
status: 200,
responseHeaders: {
"Content-Type": "application/vnd.go.cd.v1+json; charset=utf-8"
},
responseText: JSON.stringify(TestData.authConfigList(TestData.ldapAuthConfig()))
};
}
示例3: it
it("should validate length for id", () => {
const ldapAuthConfigJSON = TestData.ldapAuthConfig();
ldapAuthConfigJSON.id = "This-is-longer-then-255-characters_This-is-longer-then-255-characters_This-is-longer-then-255-characters_This-is-longer-then-255-characters_This-is-longer-then-255-characters_This-is-longer-then-255-characters_This-is-longer-then-255-characters_This-is-longer-then-255-characters";
const authConfigs = AuthConfigs.fromJSON(TestData.authConfigList(ldapAuthConfigJSON));
const isValid = authConfigs[0].isValid();
expect(isValid).toBe(false);
expect(authConfigs[0].errors().count()).toEqual(1);
expect(authConfigs[0].errors().keys()).toEqual(["id"]);
});