public static TestFixture_WebServices set_TM_Server(this TestFixture_WebServices tfWebServices, string websiteUrl = null) { tfWebServices.WebSite_Url = websiteUrl.valid() ? websiteUrl.uri() : tfWebServices.default_TM_Server(); tfWebServices.webServices = new TM_WebServices_Configured(tfWebServices.WebSite_Url); return(tfWebServices); }
public static HttpWebResponse http_GET_WebResponse(this TestFixture_WebServices tfWebServices, string virtualPath) { var url = tfWebServices.WebSite_Url.append(virtualPath); var webRequest = tfWebServices.webServices.getWebRequest_Configured(url); webRequest.AllowAutoRedirect = true; return(tfWebServices.webServices.getWebResponse()); }
public static string http_GET(this TestFixture_WebServices tfWebServices, string virtualPath) { if (tfWebServices.notNull() && virtualPath.valid()) { var webResponse = tfWebServices.http_GET_WebResponse(virtualPath); var stream = webResponse.GetResponseStream(); return(stream.readToEnd()); } return(""); }
public static Test_User login_As_Reader(this TestFixture_WebServices tfWebServices) { var readerUser = tfWebServices.QAConfig.testUser("qa-reader"); var authToken = readerUser.AuthToken; if (tfWebServices.webServices.login_with_AuthToken(authToken)) { return(readerUser); } return(null); }
public static Test_User login_As_Admin(this TestFixture_WebServices tfWebServices) { var adminUser = tfWebServices.QAConfig.testUser("qa-admin"); var authToken = adminUser.AuthToken; if (tfWebServices.webServices.login_with_AuthToken(authToken)) { return(adminUser); } return(null); }
public static string http_METHOD(this TestFixture_WebServices tfWebServices, string method, string contentType, string virtualPath, string postData) { if (tfWebServices.notNull() && virtualPath.valid() && postData.valid()) { var webResponse = tfWebServices.http_METHOD_WebResponse(method, contentType, virtualPath, postData); var stream = webResponse.GetResponseStream(); return(stream.readToEnd()); } return(""); }
public static HttpWebResponse http_METHOD_WebResponse(this TestFixture_WebServices tfWebServices, string method, string contentType, string virtualPath, string postData) { var url = tfWebServices.WebSite_Url.append(virtualPath); var webRequest = tfWebServices.webServices.getWebRequest_Configured(url); webRequest.AllowAutoRedirect = true; webRequest.Method = method; webRequest.ContentType = contentType; var data = postData.asciiBytes(); webRequest.ContentLength = data.Length; Stream myStream = webRequest.GetRequestStream(); myStream.Write(data, 0, data.Length); myStream.Close(); return(tfWebServices.webServices.getWebResponse()); }
public static Uri default_TM_Server(this TestFixture_WebServices tfWebServices) { return(tfWebServices.QAConfig.Url_Target_TM_Site.uri()); }
public static string http_PUT_JSON(this TestFixture_WebServices tfWebServices, string virtualPath, string postData) { return(tfWebServices.http_METHOD("PUT", "application/json", virtualPath, postData)); }
public static string http_PUT(this TestFixture_WebServices tfWebServices, string virtualPath, string postData) { return(tfWebServices.http_METHOD("PUT", "x-www-form-urlencoded", virtualPath, postData)); }