public void SetUpBase() { var request = new GetAuthentication(new UserCredentials(Credentials.USERNAME, Credentials.API_KEY)); var cfrequest = new CloudFilesRequest((HttpWebRequest) WebRequest.Create(request.CreateUri())); request.Apply(cfrequest); var response = new ResponseFactory().Create(cfrequest); storageUrl = response.Headers[Constants.XStorageUrl]; authToken = response.Headers[Constants.XAuthToken]; Assert.That(authToken.Length, Is.EqualTo(36)); connection = new Connection(new UserCredentials(Credentials.USERNAME, Credentials.API_KEY)); SetUp(); }
public void SetUpBase() { var credentials = new UserCredentials(new Uri(Credentials.AUTH_ENDPOINT), Credentials.USERNAME,Credentials.API_KEY); var request = new GetAuthentication(credentials); var cfrequest = new CloudFilesRequest((HttpWebRequest) WebRequest.Create(request.CreateUri())); request.Apply(cfrequest); var response = new ResponseFactory().Create(cfrequest); storageUrl = response.Headers[Constants.XStorageUrl]; authToken = response.Headers[Constants.XAuthToken]; connection = new Connection(credentials); if (!connection.HasCDN()) Assert.Ignore("Provider does not support CDN Management"); SetUp(); }
public void Should_replace_plus_sign_with_percent_20_on_account_name_username_and_password() { UserCredentials userCreds = new UserCredentials(new Uri("http://tempuri"), "user name", "pass word", "v 1", "account name"); GetAuthentication getAuthentication = new GetAuthentication(userCreds); var _mockrequest = new Mock<ICloudFilesRequest>(); var headers = new WebHeaderCollection(); _mockrequest.SetupGet(x => x.Headers).Returns(headers); getAuthentication.Apply(_mockrequest.Object); Assert.That(getAuthentication.CreateUri().AbsoluteUri, Is.EqualTo("http://tempuri//v%201/account%20name/auth")); Assert.That(headers[utils.Constants.X_AUTH_USER], Is.EqualTo("user%20name")); Assert.That(headers[utils.Constants.X_AUTH_KEY], Is.EqualTo("pass%20word")); }