Example #1
0
        public void GetEnvironmentClientCredentialWithoutAKTest()
        {
            var defaultCredentialProvider = new DefaultCredentialProvider();
            var credential = (BasicCredentials)defaultCredentialProvider.GetEnvironmentAlibabaCloudCredential();

            Assert.Null(credential);
        }
Example #2
0
        public void GetEnvironmentAlibabaCloudCredentialWithEnvAKTest()
        {
            var profile = DefaultProfile.GetProfile();

            profile.DefaultClientName = "default";

            TestHelper.InitializeEnvironmentValue();

            var defaultCredentialProvider = new DefaultCredentialProvider(profile, null);
            var credential = (BasicCredentials)defaultCredentialProvider.GetEnvironmentAlibabaCloudCredential();

            Assert.NotNull(credential);
            Assert.Equal("ACCESS_KEY_ID", credential.GetAccessKeyId());

            TestHelper.RemoveEnvironmentValue();
        }