当前位置: 首页>>代码示例>>Java>>正文


Java RestAssured.authentication方法代码示例

本文整理汇总了Java中io.restassured.RestAssured.authentication方法的典型用法代码示例。如果您正苦于以下问题:Java RestAssured.authentication方法的具体用法?Java RestAssured.authentication怎么用?Java RestAssured.authentication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.restassured.RestAssured的用法示例。


在下文中一共展示了RestAssured.authentication方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

import io.restassured.RestAssured; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws MalformedURLException {
    // set base URI and port number to use for all requests
    serverUrl = System.getProperty("test.url");
    String protocol = DEFAULT_PROTOCOL;
    String host = DEFAULT_HOST;
    int port = DEFAULT_PORT;

    if (serverUrl != null) {
        URL url = new URL(serverUrl);
        protocol = url.getProtocol();
        host = url.getHost();
        port = (url.getPort() == -1) ? DEFAULT_PORT : url.getPort();
    }

    RestAssured.baseURI = protocol + "://" + host;
    RestAssured.port = port;

    username = System.getProperty("test.user");
    password = System.getProperty("test.pwd");

    if (username != null && password != null) {
        RestAssured.authentication = RestAssured.basic(username, password);
        RestAssured.useRelaxedHTTPSValidation();
    }
    RestAssured.defaultParser = Parser.JSON;

    if (StringUtils.isBlank(serverUrl)) {
        serverUrl = DEFAULT_PROTOCOL + "://" + DEFAULT_HOST + ":" + DEFAULT_PORT;
    }
    headers.put(YamlToJsonConverterServlet.TCK_HEADER_SERVERURL, serverUrl);
    if (StringUtils.isNotBlank(username)) {
        headers.put(YamlToJsonConverterServlet.TCK_HEADER_USERNAME, username);
    }
    if (StringUtils.isNotBlank(password)) {
        headers.put(YamlToJsonConverterServlet.TCK_HEADER_PASSWORD, password);
    }
}
 
开发者ID:eclipse,项目名称:microprofile-open-api,代码行数:39,代码来源:AppTestBase.java

示例2: setup

import io.restassured.RestAssured; //导入方法依赖的package包/类
@Before
public void setup() {
	RestAssured.baseURI =
			"https://api.stripe.com/";
	RestAssured.authentication =
			RestAssured.basic("sk_test_BQokikJOvBiI2HlWgH4olfQ2", "");
}
 
开发者ID:marcingrzejszczak,项目名称:the-legacy-app,代码行数:8,代码来源:BaseClass.java

示例3: setup

import io.restassured.RestAssured; //导入方法依赖的package包/类
@Before
public void setup() {
	RestAssured.baseURI = "https://127.0.0.1:8443/web";
	RestAssured.basePath = "";
	//RestAssured.useRelaxedHTTPSValidation();
	//RestAssured.config = RestAssuredConfig.newConfig().sslConfig(SSLConfig.sslConfig().allowAllHostnames());
			
	RestAssured.authentication = RestAssured
			.certificate("clq.truststore",
					"123456","clq.p12", "123456",
					CertificateAuthSettings
					.certAuthSettings()
					.keyStoreType("PKCS12")
					.trustStoreType("jks"));
}
 
开发者ID:strictnerd,项目名称:LearningSummary,代码行数:16,代码来源:HTTPSApiJsonTest.java

示例4: init

import io.restassured.RestAssured; //导入方法依赖的package包/类
@BeforeClass
public void init() {
    RestAssured.authentication = RestAssured.basic("28accbe43ea112d9feb328d2c00b3eed", "");
}
 
开发者ID:LadyTurandot,项目名称:Java_Good,代码行数:5,代码来源:RestAssuredTests.java


注:本文中的io.restassured.RestAssured.authentication方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。