def test_parse_no_errors(self): '''Ensure successful command parsing''' myargs = ["-n", "myservice", "-s", "/tmp/myiso.iso"] options = create_service.parse_options(myargs) self.assertEquals(options.svcname, "myservice") self.assertEquals(options.srcimage, "/tmp/myiso.iso") # Make sure passing no options is ok myargs = list() options = create_service.parse_options(myargs) self.assertEquals(options.srcimage, "pkg:/install-image/solaris-auto-install")
def test_publisher_syntax(self): '''Ensure publisher string is of form 'publisher=uri' ''' myargs = ["-p", "solarishttp://www.example.com:10000"] self.assertRaises(SystemExit, create_service.parse_options, myargs) myargs = ["-p", "solaris=http://www.example.com:10000"] options = create_service.parse_options(myargs) self.assertEquals(options.publisher[0], "solaris") self.assertEquals(options.publisher[1], "http://www.example.com:10000")