Esempio n. 1
0
        public void TestTokenSetBeforeNoEnvVarAddFileUris()
        {
            FakeGetEnvConnectionInformation fakeGetEnvConnectionInformation = new FakeGetEnvConnectionInformation(false, false, false);
            FakeEnvironmentPathGetter       fakeEnvironmentPathGetter       = new FakeEnvironmentPathGetter();
            FakeFileInformationGetter       fakeFileInformationGetter       = new FakeFileInformationGetter();
            var ret = new ApiConnectionConfigurationRetriever(fakeEnvironmentPathGetter, fakeGetEnvConnectionInformation, fakeFileInformationGetter);
            var api = new APIConnectionInformation()
            {
                Token             = "token0",
                ApiUri            = null,
                StorageUri        = null,
                SetForcePathStyle = null,
                SetDisableBucketPathsSanitization = null,
                SetUnsafeSsl        = null,
                SetStorageUnsafeSsl = null
            };

            ret.RetrieveConfigurationInformation(api);
            Assert.AreEqual(api.Token, "token0");
            Assert.AreEqual(api.ApiUri, "api_file");
            Assert.AreEqual(api.StorageUri, "storage_file");
            Assert.AreEqual(api.ForcePathStyle, false);
            Assert.AreEqual(api.GetForcePathStyle, null);
            Assert.AreEqual(false, api.DisableBucketPathsSanitization);
            Assert.AreEqual(null, api.GetDisableBucketPathsSanitization);
            Assert.AreEqual(false, api.UnsafeSsl);
            Assert.AreEqual(null, api.GetUnsafeSsl);
            Assert.AreEqual(false, api.StorageUnsafeSsl);
            Assert.AreEqual(null, api.GetStorageUnsafeSsl);
        }
Esempio n. 2
0
        public void TestNoEnvVarSet()
        {
            var fakeGetEnvConnectionInformation = new FakeGetEnvConnectionInformation(false, false, false);
            FakeEnvironmentPathGetter fakeEnvironmentPathGetter = new FakeEnvironmentPathGetter();
            FakeFileInformationGetter fakeFileInformationGetter = new FakeFileInformationGetter();
            var ret = new ApiConnectionConfigurationRetriever(fakeEnvironmentPathGetter, fakeGetEnvConnectionInformation, fakeFileInformationGetter);
            var api = new APIConnectionInformation()
            {
                Token      = null,
                ApiUri     = null,
                StorageUri = null,
            };

            ret.RetrieveConfigurationInformation(api);
            Assert.AreEqual(api.Token, "token_file");
            Assert.AreEqual(api.ApiUri, "api_file");
            Assert.AreEqual(api.StorageUri, "storage_file");
        }
Esempio n. 3
0
        public void TestAllEnvVarSet()
        {
            var fakeGetEnvConnectionInformation = new FakeGetEnvConnectionInformation(true, true, true, envUnsafe: true, envStorageUnsafe: true);
            FakeEnvironmentPathGetter fakeEnvironmentPathGetter = new FakeEnvironmentPathGetter();
            FakeFileInformationGetter fakeFileInformationGetter = new FakeFileInformationGetter();
            var ret = new ApiConnectionConfigurationRetriever(fakeEnvironmentPathGetter, fakeGetEnvConnectionInformation, fakeFileInformationGetter);
            var api = new APIConnectionInformation()
            {
                Token             = null,
                ApiUri            = null,
                StorageUri        = null,
                SetForcePathStyle = null,
            };

            ret.RetrieveConfigurationInformation(api);
            Assert.AreEqual(api.Token, "token_env");
            Assert.AreEqual(api.ApiUri, "api_env");
            Assert.AreEqual(api.StorageUri, "storage_env");
            Assert.AreEqual(api.ForcePathStyle, true);
            Assert.AreEqual(api.UnsafeSsl, true);
            Assert.AreEqual(api.StorageUnsafeSsl, true);
        }
Esempio n. 4
0
        public void TestUriEnvVarSet()
        {
            var fakeGetEnvConnectionInformation = new FakeGetEnvConnectionInformation(false, true, false);
            FakeEnvironmentPathGetter fakeEnvironmentPathGetter = new FakeEnvironmentPathGetter();
            FakeFileInformationGetter fakeFileInformationGetter = new FakeFileInformationGetter();
            var ret = new ApiConnectionConfigurationRetriever(fakeEnvironmentPathGetter, fakeGetEnvConnectionInformation, fakeFileInformationGetter);
            var api = new APIConnectionInformation()
            {
                Token          = null,
                ApiUri         = null,
                StorageUri     = null,
                AccountEmail   = null,
                ForcePathStyle = false,
            };

            ret.RetrieveConfigurationInformation(api);
            Assert.AreEqual(api.Token, "token_file");
            Assert.AreEqual(api.ApiUri, "api_env");
            Assert.AreEqual(api.StorageUri, "storage_file");
            Assert.AreEqual(api.AccountEmail, "email_file");
            Assert.AreEqual(api.ForcePathStyle, false);
            Assert.AreEqual(api.GetForcePathStyle, false);
        }