Exemplo n.º 1
0
 def push(self, path, output_dir, feed, nuget_path, api_key):
     """
     Pushes NuGet package on to the NuGet feed.
     :param path: Path to the NuGet Package
     :param output_dir: Output directory in which NuGet package will be searched, if it's not explicitly provided.
     :param feed: NuGet feed URI
     :param nuget_path: Path to the NuGet executable
     :param api_key: NuGet Api Key
     :return: Exit code of the NuGet push command
     """
     nupkg_path = self._locate_nupkg_at_path(path, output_dir)
     nuget_path = self._locate_nuget_path(nuget_path)
     nuget = NuGetRunner(nuget_path, self.debug)
     return nuget.push(nupkg_path, feed, api_key)
Exemplo n.º 2
0
    def test_nuget_runner_push(self, mock_popen):
        """Test NuGetRunner.push"""
        mock_process = MagicMock()
        mock_process.wait.return_value = 0
        mock_popen.return_value = mock_process

        expected_command_str = "nuget.exe push Test.nupkg -Verbosity normal " \
                               "-Source http://test.com/nuget " \
                               "-ApiKey myapikey7"

        nuget_runner = NuGetRunner("nuget.exe")
        assert nuget_runner.push("Test.nupkg", "http://test.com/nuget",
                                 "myapikey7") == 0
        mock_popen.assert_called_with(expected_command_str, shell=True)