示例#1
0
        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();
        }
示例#2
0
        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();
        }