Beispiel #1
0
    def test_basedir1(self):

        bd = '/blablub'
        LOG.info("Testing #1 wrong basedir: %r", bd)

        from fb_tools.obj import FbBaseObject

        obj = FbBaseObject(appname='test_base_object', base_dir=bd)     # noqa
Beispiel #2
0
    def test_basedir2(self):

        bd = '/etc/passwd'
        LOG.info("Testing #2 wrong basedir: %r", bd)

        from fb_tools.obj import FbBaseObject

        obj = FbBaseObject(appname='test_base_object', base_dir=bd)     # noqa
Beispiel #3
0
    def test_as_dict1(self):

        LOG.info("Testing obj.as_dict() #1 - simple")

        from fb_tools.obj import FbBaseObject

        obj = FbBaseObject(appname='test_base_object', verbose=1)

        di = obj.as_dict()
        LOG.debug("Got FbBaseObject.as_dict(): %r", di)
        self.assertIsInstance(di, dict)
Beispiel #4
0
    def test_verbose2(self):

        LOG.info("Testing wrong verbose values #2.")

        from fb_tools.obj import FbBaseObject

        v = -2
        obj = None

        with self.assertRaises(ValueError) as cm:
            obj = FbBaseObject(appname='test_base_object', verbose=v)   # noqa
        e = cm.exception
        LOG.debug("ValueError raised on verbose = %r: %s", v, str(e))
Beispiel #5
0
    def test_object(self):

        LOG.info("Testing init of a simple object.")

        from fb_tools.obj import FbGenericBaseObject, FbBaseObject

        with self.assertRaises(TypeError) as cm:
            gen_obj = FbGenericBaseObject()                         # noqa
        e = cm.exception
        LOG.debug("TypeError raised on instantiate a FbGenericBaseObject: %s", str(e))

        obj = FbBaseObject(
            appname='test_base_object',
            verbose=1,
        )
        LOG.debug("FbBaseObject %%r: %r", obj)
        LOG.debug("FbBaseObject %%s: %s", str(obj))