def test_validateMasterArgument_ok(self):
     """
     test calling CreateWorkerOptions.validateMasterArgument()
     on <master> without host and port parts specified.
     """
     opts = runner.CreateWorkerOptions()
     self.assertEqual(opts.validateMasterArgument("mstrhost:4321"),
                      ("mstrhost", 4321),
                      "incorrect master host and/or port")
 def test_validateMasterArgument_no_port(self):
     """
     test calling CreateWorkerOptions.validateMasterArgument()
     on <master> argument without port specified.
     """
     opts = runner.CreateWorkerOptions()
     self.assertEqual(opts.validateMasterArgument("mstrhost"),
                      ("mstrhost", 9989),
                      "incorrect master host and/or port")
 def test_validateMasterArgument_empty_master(self):
     """
     test calling CreateWorkerOptions.validateMasterArgument()
     on <master> without host part specified.
     """
     opts = runner.CreateWorkerOptions()
     self.assertRaisesRegexp(usage.UsageError,
                             "invalid <master> argument ':1234'",
                             opts.validateMasterArgument, ":1234")
 def test_validateMasterArgument_inv_port(self):
     """
     test calling CreateWorkerOptions.validateMasterArgument()
     on <master> without with unparsable port part
     """
     opts = runner.CreateWorkerOptions()
     self.assertRaisesRegexp(
         usage.UsageError, "invalid master port 'apple', "
         "needs to be an number", opts.validateMasterArgument, "host:apple")
 def test_validateMasterArgument_ipv6_port(self):
     """
     test calling CreateWorkerOptions.validateMasterArgument()
     on <master> with ipv6 host and port parts specified.
     """
     opts = runner.CreateWorkerOptions()
     self.assertEqual(opts.validateMasterArgument("[2001:1:2:3:4::1]:4321"),
                      ("2001:1:2:3:4::1", 4321),
                      "incorrect master host and/or port")
 def test_validateMasterArgument_ipv4_port(self):
     """
     test calling CreateWorkerOptions.validateMasterArgument()
     on <master> with ipv4 host and port parts specified.
     """
     opts = runner.CreateWorkerOptions()
     self.assertEqual(opts.validateMasterArgument("192.168.0.0:4321"),
                      ("192.168.0.0", 4321),
                      "incorrect master host and/or port")
 def test_validateMasterArgument_ipv6_no_bracket(self):
     """
     test calling CreateWorkerOptions.validateMasterArgument()
     on <master> with ipv6 without [] specified.
     """
     opts = runner.CreateWorkerOptions()
     with self.assertRaisesRegex(
             usage.UsageError,
             r"invalid <master> argument '2001:1:2:3:4::1:4321', "
             r"if it is an ipv6 address, it must be enclosed by \[\]"):
         opts.validateMasterArgument("2001:1:2:3:4::1:4321")
 def test_synopsis(self):
     opts = runner.CreateWorkerOptions()
     self.assertIn('buildbot-worker create-worker', opts.getSynopsis())
 def parse(self, *args):
     opts = runner.CreateWorkerOptions()
     opts.parseOptions(args)
     return opts
Exemple #10
0
 def test_synopsis(self):
     opts = runner.CreateWorkerOptions()
     self.assertIn('buildslave create-slave', opts.getSynopsis())