def testCfgHttpUrlType(self): config = rbuildcfg.RbuildConfiguration() err = self.assertRaises(cfg.ParseError, config.configLine, 'serverUrl http://:myrbuilder.foo') self.assertIn('valid http', str(err)) err = self.assertRaises(cfg.ParseError, config.configLine, 'serverUrl http://[email protected]') self.assertIn('URL entries', str(err)) config.configLine('serverUrl http://myrbuilder.foo:port') config.configLine('serverUrl http://myrbuilder.foo')
def testIsComplete(self): handle = self.getRbuildHandle() cfg = rbuildcfg.RbuildConfiguration() assert (not handle.Config.isComplete(cfg)) cfg.serverUrl = 'foo' assert (not handle.Config.isComplete(cfg)) cfg.user = ('foo', 'bar') assert (not handle.Config.isComplete(cfg)) cfg.name = 'Name' assert (not handle.Config.isComplete(cfg)) cfg.contact = 'Contact' assert (handle.Config.isComplete(cfg))
def setUp(self): rmakehelp.RmakeHelper.setUp(self) self.rbuildCfg = rbuildcfg.RbuildConfiguration(readConfigFiles=False, root=self.cfg.root) self.rbuildCfg.contact = self.cfg.contact self.rbuildCfg.name = self.cfg.name self.rbuildCfg.pluginDirs = resources.get_plugin_dirs() self.rbuildCfg.serverUrl = 'some non-empty value' self.rbuildCfg.rmakePluginDirs = rmake_resources.get_plugin_dirs() self.writeFile(self.cfg.root + '/conaryrc', '') self.rbuildCfg.user = ('test', 'foo') self.setUpSchemaDir()
def setUp(self): rmakehelp.RmakeHelper.setUp(self) self.rbuildCfg = rbuildcfg.RbuildConfiguration(readConfigFiles=False, root=self.cfg.root) self.rbuildCfg.contact = self.cfg.contact self.rbuildCfg.name = self.cfg.name self.rbuildCfg.pluginDirs = resources.get_plugin_dirs() self.rbuildCfg.serverUrl = 'http://example.com' self.rbuildCfg.rmakePluginDirs = rmake_resources.get_plugin_dirs() self.writeFile(self.cfg.root + '/conaryrc', '') self.rbuildCfg.user = ('test', 'foo') self.rbuildCfg.recipeTemplateDirs.insert(0, resources.get_test_path('config', 'recipeTemplates')) self.setUpSchemaDir()
def testWriteCheckoutFile(self): """ Validate the output of the function used to write the rbuildrc in new product checkouts. """ config = rbuildcfg.RbuildConfiguration() config.configLine('name Mr. User') config.configLine('contact [email protected]') config.configLine('repositoryMap []') config.configLine('repositoryMap bar.com https://dev.bar.com/conary/') config.configLine('repositoryMap foo.com https://repo.foo.com/conary/') config.configLine('repositoryUser bar.com baruser barpassword') config.configLine('repositoryUser foo.com foouser foopassword') config.configLine('user someuser somepassword') config.configLine('serverUrl http://myrbuilder.foo') config.configLine('signatureKey ASDF') config.configLine('signatureKeyMap foo FDSA') config.configLine('quiet True') dumpFile = tempfile.NamedTemporaryFile() config.writeCheckoutFile(dumpFile.name) dumpFile.seek(0) dump = dumpFile.read() expected = '''\ # applianceTemplate (Default: groupSetAppliance) (At `rbuild init': groupSetAppliance) # contact (Default: None) (At `rbuild init': [email protected]) # factoryTemplate (Default: factory) (At `rbuild init': factory) # groupTemplate (Default: groupSet) (At `rbuild init': groupSet) # name (Default: None) (At `rbuild init': Mr. User) # pluginDirs (Default: /usr/share/rbuild/plugins:~/.rbuild/plugins.d) (At `rbuild init': /usr/share/rbuild/plugins:~/.rbuild/plugins.d) # quiet (Default: False) (At `rbuild init': True) # recipeTemplate (Default: default) (At `rbuild init': default) # recipeTemplateDirs (Default: ~/.conary/recipeTemplates:/etc/conary/recipeTemplates) (At `rbuild init': ~/.conary/recipeTemplates:/etc/conary/recipeTemplates) # repositoryMap (Default: []) repositoryMap bar.com https://dev.bar.com/conary/ repositoryMap foo.com https://repo.foo.com/conary/ # repositoryUser (Default: []) (At `rbuild init': bar.com baruser barpassword, foo.com foouser foopassword) # rmakePluginDirs (Default: /usr/share/rmake/plugins:~/.rmake/plugins.d) (At `rbuild init': /usr/share/rmake/plugins:~/.rmake/plugins.d) # rmakeUrl (Default: None) (At `rbuild init': None) # serverUrl (Default: None) (At `rbuild init': http://myrbuilder.foo) # signatureKey (Default: None) (At `rbuild init': ASDF) # signatureKeyMap (Default: []) (At `rbuild init': foo FDSA) ''' self.assertEqualWithDiff(dump, expected)
def testWriteCheckoutFile(self): """ Validate the output of the function used to write the rbuildrc in new product checkouts. """ config = rbuildcfg.RbuildConfiguration() config.configLine('name Mr. User') config.configLine('contact [email protected]') config.configLine('repositoryMap []') config.configLine('repositoryMap foo.com https://repo.foo.com/conary/') config.configLine('repositoryMap bar.com https://dev.bar.com/conary/') config.configLine('user someuser somepassword') config.configLine('serverUrl http://myrbuilder.foo') config.configLine('signatureKey ASDF') config.configLine('signatureKeyMap foo FDSA') config.configLine('quiet True') dumpFile = tempfile.NamedTemporaryFile() config.writeCheckoutFile(dumpFile.name) dumpFile.seek(0) dump = dumpFile.read() expected = '''# contact (Default: None) (At `rbuild init': [email protected]) # name (Default: None) (At `rbuild init': Mr. User) # pluginDirs (Default: /usr/share/rbuild/plugins:~/.rbuild/plugins.d) (At `rbuild init': /usr/share/rbuild/plugins:~/.rbuild/plugins.d) # quiet (Default: False) (At `rbuild init': True) # repositoryMap (Default: []) repositoryMap foo.com https://repo.foo.com/conary/ repositoryMap bar.com https://dev.bar.com/conary/ # rmakePluginDirs (Default: /usr/share/rmake/plugins:~/.rmake/plugins.d) (At `rbuild init': /usr/share/rmake/plugins:~/.rmake/plugins.d) # rmakeUrl (Default: None) (At `rbuild init': None) # serverUrl (Default: None) (At `rbuild init': http://myrbuilder.foo) # signatureKey (Default: None) (At `rbuild init': ASDF) # signatureKeyMap (Default: []) (At `rbuild init': foo FDSA) ''' self.failUnlessEqual(dump, expected)