def testParseBouncerComponent(self): f = self._buildManager("""<component name="foobar" type="bouncer"/>""") config = ManagerConfigParser(f) self.failIf(config.bouncer) config.parseBouncerAndPlugs() self.failUnless(config.bouncer) self.failUnless(isinstance(config.bouncer, ConfigEntryComponent)) self.assertEquals(config.bouncer.type, 'bouncer') self.assertEquals(config.bouncer.name, 'foobar')
def testParseBouncerComponent(self): f = self._buildManager("""<component name="foobar" type="trivial-bouncer"/>""") config = ManagerConfigParser(f) self.failIf(config.bouncer) config.parseBouncerAndPlugs() self.failUnless(config.bouncer) self.failUnless(isinstance(config.bouncer, ConfigEntryComponent)) self.assertEquals(config.bouncer.type, 'trivial-bouncer') self.assertEquals(config.bouncer.name, 'foobar')
def testParsePlugs(self): f = self._buildManager("""<plugs> <plug type="adminaction-loggerfile"> <property name="logfile">/dev/stdout</property> </plug> </plugs>""") config = ManagerConfigParser(f) self.failIf(flatten(config.plugs.values())) config.parseBouncerAndPlugs() values = flatten(config.plugs.values()) self.failUnless(values) first = values[0] self.failUnless(isinstance(first, dict)) self.failUnless('type' in first) self.assertEquals(first['type'], 'adminaction-loggerfile') self.failUnless('properties' in first) properties = first['properties'] self.failUnless('logfile' in properties) self.assertEquals(properties['logfile'], '/dev/stdout')
def testParsePlugs(self): f = self._buildManager( """<plugs> <plug type="adminaction-loggerfile"> <property name="logfile">/dev/stdout</property> </plug> </plugs>""") config = ManagerConfigParser(f) self.failIf(flatten(config.plugs.values())) config.parseBouncerAndPlugs() values = flatten(config.plugs.values()) self.failUnless(values) first = values[0] self.failUnless(isinstance(first, dict)) self.failUnless('type' in first) self.assertEquals(first['type'], 'adminaction-loggerfile') self.failUnless('properties' in first) properties = first['properties'] self.failUnless('logfile' in properties) self.assertEquals(properties['logfile'], '/dev/stdout')