public void TestValidateInvalid() { var input = new LineInputter("what is this nonsense"); Assert.Equal(1, AProgram.Main(_testAssembly, input.ReadLine, "validate", "--apikey", "abc")); }
public void TestBuildIsoDryrun() { var input = new LineInputter(Resources.BuildIsoConfig); using var requests = new MockVultrRequests( new HttpHandler( "account/info", Resources.VultrAccountInfo), new HttpHandler( "startupscript/list", new[] { StartupScriptListWithBuildIso, StartupScriptListWithBuildIso }), new HttpHandler("os/list", Resources.VultrOSList), new HttpHandler( "regions/list?availability=yes", Resources.VultrRegionsList), new HttpHandler( "plans/list?type=all", Resources.VultrPlansList), new HttpHandler( "firewall/group_list", Resources.VultrFirewallGroupsPublic), new HttpHandler("sshkey/list", "{}"), new HttpHandler("server/list", "{}")); AProgram.Main(null, input.ReadLine, "provision", "--dryrun", "--apikey", ApiKey, "--apiurl", requests.Url).Should().Be(0); requests.AssertAllCalledOnce(); }
public void TestValidate() { var input = new LineInputter(Resources.TestPlatformConfig); Assert.Equal(0, AProgram.Main(_testAssembly, input.ReadLine, "validate", "--apiurl", "http://example.org/")); }
public void TestProvisionDryrun() { const string expected = "plan.cpu=2&plan.memory=4096&plan.type=SSD&" + "os.name=Fedora%2032%20x64&os.app=Fedora%2032%20x64&" + "os.iso=&dryrun=True"; using var requests = new MockVultrRequests( new HttpHandler( "provision", expected, "")); var input = new LineInputter(Resources.TestPlatformConfig); Assert.Equal(0, AProgram.Main(_testAssembly, input.ReadLine, "provision", "--apiurl", requests.Url, "--dryrun")); requests.AssertAllCalledOnce(); }
public void TestBuildIsoDryrunNoBuildScript() { var input = new LineInputter(Resources.BuildIsoConfig); using var requests = new MockVultrRequests( new HttpHandler( "account/info", Resources.VultrAccountInfo), new HttpHandler( "startupscript/list", new[] { "{}", "{}" })); AProgram.Main(null, input.ReadLine, "provision", "--dryrun", "--apikey", ApiKey, "--apiurl", requests.Url).Should().Be(3); requests.AssertAllCalledOnce(); }
public void TestHelp() { Assert.Equal( 0, AProgram.Main(_testAssembly, ReadLine, "help")); }
public void TestBadArguments() { Assert.Equal( 2, AProgram.Main(_testAssembly, ReadLine, "bad", "arguments")); }