本文整理匯總了Java中com.jayway.restassured.RestAssured.authentication方法的典型用法代碼示例。如果您正苦於以下問題:Java RestAssured.authentication方法的具體用法?Java RestAssured.authentication怎麽用?Java RestAssured.authentication使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.jayway.restassured.RestAssured
的用法示例。
在下文中一共展示了RestAssured.authentication方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setup
import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
static public void setup() throws MalformedURLException {
// set base URI and port number to use for all requests
String 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;
// set user name and password to use for basic authentication for all requests
String userName = System.getProperty("test.user");
String password = System.getProperty("test.pwd");
if (userName != null && password != null) {
RestAssured.authentication = RestAssured.basic(userName, password);
RestAssured.useRelaxedHTTPSValidation();
}
}
示例2: init
import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
@BeforeClass
public void init() {
RestAssured.authentication = RestAssured.basic("LSGjeU4yP1X493ud1hNniA==", "");
}
示例3: RestHelper
import com.jayway.restassured.RestAssured; //導入方法依賴的package包/類
public RestHelper(ApplicationManager app) {
this.app = app;
RestAssured.authentication = RestAssured.basic(app.getProperty("rest.token"), "");
}