예제 #1
0
        public void CanCreateUpdateDeletePython2Packages()
        {
            using (var context = MockContext.Start(GetType().FullName))
            {
                using (var testFixture = new AutomationTestBase(context))
                {
                    var python2PackageName = "numpy";
                    // Content links don't have to be valid for playback. However, these are the actual module download locations used for recording.
                    var contentLink1 = "https://bhbrahmaprodtestingseau.blob.core.windows.net/module1/numpy-1.14.5-cp27-none-win_amd64.whl";
                    var contentLink2 = "https://bhbrahmaprodtestingseau.blob.core.windows.net/module2/numpy-1.15.2-cp27-none-win_amd64.whl";

                    testFixture.DeletePython2Package(python2PackageName, true);

                    var python2Package = testFixture.CreateAutomationPython2Package(python2PackageName, contentLink1);

                    Assert.NotNull(python2Package);
                    Assert.Equal(ModuleProvisioningState.Creating, python2Package.ProvisioningState);
                    python2Package = EnsurePython2PackageReachesSuccessProvisioningState(python2PackageName, testFixture);
                    Assert.Equal(python2PackageName, python2Package.Name);
                    Assert.Equal("1.14.5", python2Package.Version);

                    // Update the module
                    python2Package = testFixture.CreateAutomationPython2Package(python2PackageName, contentLink2);
                    Assert.NotNull(python2Package);
                    Assert.Equal(ModuleProvisioningState.Creating, python2Package.ProvisioningState);
                    python2Package = EnsurePython2PackageReachesSuccessProvisioningState(python2PackageName, testFixture);
                    Assert.Equal(python2PackageName, python2Package.Name);
                    Assert.Equal("1.15.2", python2Package.Version);

                    // Delete the module
                    bool deleteCompleted = false;
                    testFixture.DeletePython2Package(python2PackageName);
                    try
                    {
                        testFixture.GetAutomationPython2Package(python2PackageName);
                    }
                    catch (ErrorResponseException)
                    {
                        // Exception expected
                        deleteCompleted = true;
                    }
                    Assert.True(deleteCompleted);
                }
            }
        }