當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。