Пример #1
0
        public void NewBlobSasWithInvalidLifeTime()
        {
            string   containerName = Utility.GenNameString("container");
            string   blobName      = Utility.GenNameString("blob");
            DateTime start         = DateTime.UtcNow;
            DateTime end           = start.AddHours(1.0);

            Test.Assert(!CommandAgent.NewAzureStorageBlobSAS(containerName, blobName, string.Empty, string.Empty, end, start),
                        "Generate Blob sas token with invalid should fail");
            ExpectedContainErrorMessage("The expiry time of the specified access policy should be greater than start time");
        }
Пример #2
0
        public void NewBlobSasWithNotExistPolicy()
        {
            blobUtil.SetupTestContainerAndBlob();

            try
            {
                string policyName = Utility.GenNameString("notexistpolicy");

                Test.Assert(!CommandAgent.NewAzureStorageBlobSAS(blobUtil.Container.Name, blobUtil.Blob.Name, policyName, string.Empty),
                            "Generate Blob sas token with not exist policy should fail");
                ExpectedContainErrorMessage(string.Format("Invalid access policy '{0}'.", policyName));
            }
            finally
            {
                blobUtil.CleanupTestContainerAndBlob();
            }
        }