Skip to content

Commit

Permalink
Refactor tests to point to new call locations
Browse files Browse the repository at this point in the history
  • Loading branch information
gfs committed Nov 12, 2024
1 parent f2acc13 commit dbb205e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/oss-tests/DefoggerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
namespace Microsoft.CST.OpenSource.Tests

{
using OssGadget.Tools;

[TestClass]
public class DefoggerTests
{
Expand Down
1 change: 1 addition & 0 deletions src/oss-tests/DetectCryptographyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Microsoft.CST.OpenSource.Tests
{
using ApplicationInspector.RulesEngine;
using OssGadget.Tools;
using PackageUrl;

[TestClass]
Expand Down
5 changes: 3 additions & 2 deletions src/oss-tests/FindSquatsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Microsoft.CST.OpenSource.Tests
using Extensions;
using Helpers;
using Model.Metadata;
using OssGadget.Options;
using PackageUrl;
using System.Linq;
using System.Net.Http;
Expand Down Expand Up @@ -54,12 +55,12 @@ public async Task DetectSquats(string packageUrl, bool generateSquats, bool expe

ProjectManagerFactory projectManagerFactory = new(managerOverrides);
FindSquatsTool fst = new(projectManagerFactory);
FindSquatsTool.Options options = new()
FindSquatsToolOptions options = new()
{
Quiet = true,
Targets = new string[] { packageUrl }
};
(string output, int numSquats) result = await fst.RunAsync(options);
(string output, int numSquats) result = await fst.LegacyRunAsync(options);
Assert.IsTrue(expectedToHaveSquats ? result.numSquats > 0 : result.numSquats == 0);
}

Expand Down
8 changes: 7 additions & 1 deletion src/oss-tests/ReproducibleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Microsoft.CST.OpenSource.Tests
{
using OssGadget.Options;

[TestClass]
public class ReproducibleTest
{
Expand All @@ -24,7 +26,11 @@ public ReproducibleTest()
public async Task CheckReproducibility(string packageUrl, bool? expectedToBeReproducible)
{
string? outputFilename = Guid.NewGuid().ToString() + ".json";
ReproducibleTool.Main(new[] { "-a", "-o", outputFilename, packageUrl }).Wait();
var options = new ReproducibleToolOptions()
{
AllStrategies = true, OutputFile = outputFilename, Targets = new[] { packageUrl }
};
await new ReproducibleTool().RunAsync(options);

bool outputFileExists = File.Exists(outputFilename);

Expand Down

0 comments on commit dbb205e

Please sign in to comment.