public async Task UploadAndDownLoadPackageWithMinClientVersion() { if (UrlHelper.BaseUrl.Contains("nugettest.org") || UrlHelper.BaseUrl.Contains("nuget.org")) { string packageId = DateTime.Now.Ticks + "PackageWithDotCsNames.Cs"; string version = "1.0.0"; string packageFullPath = await _packageCreationHelper.CreatePackageWithMinClientVersion(packageId, version, "2.3"); var processResult = await _commandlineHelper.UploadPackageAsync(packageFullPath, UrlHelper.V2FeedPushSourceUrl); Assert.True(processResult.ExitCode == 0, Constants.UploadFailureMessage); var packageVersionExistsInSource = _clientSdkHelper.CheckIfPackageVersionExistsInSource(packageId, version, UrlHelper.V2FeedRootUrl); var userMessage = string.Format(Constants.PackageNotFoundAfterUpload, packageId, UrlHelper.V2FeedRootUrl); Assert.True(packageVersionExistsInSource, userMessage); //Delete package from local disk so once it gets uploaded if (File.Exists(packageFullPath)) { File.Delete(packageFullPath); Directory.Delete(Path.GetFullPath(Path.GetDirectoryName(packageFullPath)), true); } _clientSdkHelper.DownloadPackageAndVerify(packageId); } }
public async Task UploadTyposquattingPackageAndBlockUser() { var packageId = "newtonsoft-json"; string version = "1.0.0"; string packageFullPath = await _packageCreationHelper.CreatePackageWithMinClientVersion(packageId, version, "2.3"); var processResult = await _commandlineHelper.UploadPackageAsync(packageFullPath, UrlHelper.V2FeedPushSourceUrl); Assert.True(processResult.ExitCode == 1, Constants.UploadFailureMessage); Assert.Contains("similar", processResult.StandardError); }
public void UploadAndDownLoadPackageWithMinClientVersion() { string packageId = DateTime.Now.Ticks.ToString() + "PackageWithDotCsNames.Cs"; string version = "1.0.0"; string packageFullPath = PackageCreationHelper.CreatePackageWithMinClientVersion(packageId, version, "2.3"); int exitCode = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl); Assert.IsTrue((exitCode == 0), Constants.UploadFailureMessage); Assert.IsTrue(ClientSDKHelper.CheckIfPackageVersionExistsInSource(packageId, version, UrlHelper.V2FeedRootUrl), Constants.PackageNotFoundAfterUpload, packageId, UrlHelper.V2FeedRootUrl); //Delete package from local disk so once it gets uploaded if (File.Exists(packageFullPath)) { File.Delete(packageFullPath); Directory.Delete(Path.GetFullPath(Path.GetDirectoryName(packageFullPath)), true); } AssertAndValidationHelper.DownloadPackageAndVerify(packageId); }
public void UploadAndDownLoadPackageWithMinClientVersion() { string packageId = DateTime.Now.Ticks.ToString() + testContextInstance.TestName; string version = "1.0.0"; string packageFullPath = PackageCreationHelper.CreatePackageWithMinClientVersion(packageId, version, "2.3"); int exitCode = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl); Assert.IsTrue((exitCode == 0), "The package upload via Nuget.exe didnt suceed properly. Check the logs to see the process error and output stream"); Assert.IsTrue(ClientSDKHelper.CheckIfPackageVersionExistsInSource(packageId, version, UrlHelper.V2FeedRootUrl), "Package {0} is not found in the site {1} after uploading.", packageId, UrlHelper.V2FeedRootUrl); //Delete package from local disk so once it gets uploaded if (File.Exists(packageFullPath)) { File.Delete(packageFullPath); Directory.Delete(Path.GetFullPath(Path.GetDirectoryName(packageFullPath)), true); } AssertAndValidationHelper.DownloadPackageAndVerify(packageId); }
public async Task UploadAndDownloadPackageWithMinClientVersion() { string packageId = $"{Guid.NewGuid():N}PackageWithDotCsNames.Cs"; string version = "1.0.0"; string packageFullPath = await _packageCreationHelper.CreatePackageWithMinClientVersion(packageId, version, "2.3"); var processResult = await _commandlineHelper.UploadPackageAsync(packageFullPath, UrlHelper.V2FeedPushSourceUrl); Assert.True(processResult.ExitCode == 0, Constants.UploadFailureMessage); await _clientSdkHelper.VerifyPackageExistsInV2AndV3Async(packageId, version); //Delete package from local disk so once it gets uploaded if (File.Exists(packageFullPath)) { File.Delete(packageFullPath); Directory.Delete(Path.GetFullPath(Path.GetDirectoryName(packageFullPath)), true); } _clientSdkHelper.DownloadPackageAndVerify(packageId, version); }