Ejemplo n.º 1
0
            public void Should_Find_Octo_Executable_If_Tool_Path_Not_Provided()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/Working/tools/octo.exe", result.Path.FullPath);
            }
Ejemplo n.º 2
0
            public void Should_Throw_If_Settings_Is_Null()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.Settings = null;

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsArgumentNullException(result, "settings");
            }
Ejemplo n.º 3
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.GivenProcessExitsWithCode(1);

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsCakeException(result, "Octo: Process returned an error (exit code 1).");
            }
Ejemplo n.º 4
0
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.GivenProcessCannotStart();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsCakeException(result, "Octo: Process was not started.");
            }
Ejemplo n.º 5
0
            public void Should_Throw_If_Api_Key_Is_Null()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.ApiKey = null;

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsArgumentException(result, "settings", "No API key specified.");
            }
Ejemplo n.º 6
0
            public void Should_Throw_If_Octo_Executable_Was_Not_Found()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.GivenDefaultToolDoNotExist();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsCakeException(result, "Octo: Could not locate executable.");
            }
Ejemplo n.º 7
0
            public void Should_Throw_If_Package_List_Is_Null()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.Packages = null;

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                AssertEx.IsArgumentNullException(result, "packagePaths");
            }
Ejemplo n.º 8
0
            public void Should_Throw_If_No_Packages_Provided()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.Packages = new List <FilePath>();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsArgumentNullException(result, "packagePaths");
            }
Ejemplo n.º 9
0
            public void Should_Use_Octo_Executable_From_Tool_Path_If_Provided_On_Windows(string toolPath, string expected)
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.Settings.ToolPath = toolPath;
                fixture.GivenSettingsToolPathExist();

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal(expected, result.Path.FullPath);
            }
Ejemplo n.º 10
0
            public void Should_Add_Configuration_File_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.Settings.ConfigurationFile = "configFile.txt";

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("push --package \"/Working/MyPackage.1.0.0.zip\" --package \"/Working/MyOtherPackage.1.0.1.nupkg\" " +
                             "--server http://octopus --apiKey API-12345 " +
                             "--configFile \"/Working/configFile.txt\"", result.Args);
            }
Ejemplo n.º 11
0
            public void Should_Add_Password_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.Settings.Password = "******";

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("push --package \"/Working/MyPackage.1.0.0.zip\" --package \"/Working/MyOtherPackage.1.0.1.nupkg\" " +
                             "--server http://octopus --apiKey API-12345 " +
                             "--pass \"secret\"", result.Args);
            }
Ejemplo n.º 12
0
            public void Should_Add_Enable_Service_Messages_Flag_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.Settings.EnableServiceMessages = true;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("push --package \"/Working/MyPackage.1.0.0.zip\" --package \"/Working/MyOtherPackage.1.0.1.nupkg\" " +
                             "--server http://octopus --apiKey API-12345 " +
                             "--enableServiceMessages", result.Args);
            }
Ejemplo n.º 13
0
            public void Should_Add_Replace_Existing_Flag_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.Settings.ReplaceExisting = true;

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("push --package \"/Working/MyPackage.1.0.0.zip\" " +
                             "--package \"/Working/MyOtherPackage.1.0.1.nupkg\" " +
                             "--replace-existing " +
                             "--server http://octopus --apiKey API-12345", result.Args);
            }
Ejemplo n.º 14
0
            public void Should_Add_Single_Argument_For_Single_Package()
            {
                // Given
                var fixture = new OctopusDeployPusherFixture();

                fixture.Packages = new List <FilePath> {
                    "MyPackage.1.0.0.zip"
                };

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("push --package \"/Working/MyPackage.1.0.0.zip\" " +
                             "--server http://octopus --apiKey API-12345", result.Args);
            }