def setUp(self):  # noqa
        import sqlahelper
        import transaction
        from c2cgeoportal.models import DBSession, Role, User, Functionality
        from c2cgeoportal.lib.dbreflection import init

        role1 = Role(name=u"__test_role1")
        user1 = User(
            username=u"__test_user1",
            password=u"__test_user1",
            role=role1
        )
        role2 = Role(name=u"__test_role2")
        user2 = User(
            username=u"__test_user2",
            password=u"__test_user2",
            role=role2
        )

        functionality1 = Functionality(u"__test_s", u"db")
        functionality2 = Functionality(u"__test_a", u"db1")
        functionality3 = Functionality(u"__test_a", u"db2")
        role2.functionalities = [functionality1, functionality2, functionality3]

        DBSession.add_all([user1, user2, role1, role2])
        transaction.commit()

        engine = sqlahelper.get_engine()
        init(engine)
    def setUp(self):  # noqa
        import sqlahelper
        import transaction
        from c2cgeoportal.models import DBSession, Role, User, Functionality
        from c2cgeoportal.lib.dbreflection import init

        create_default_ogcserver()
        role1 = Role(name=u"__test_role1")
        user1 = User(username=u"__test_user1",
                     password=u"__test_user1",
                     role=role1)
        role2 = Role(name=u"__test_role2")
        user2 = User(username=u"__test_user2",
                     password=u"__test_user2",
                     role=role2)

        functionality1 = Functionality(u"__test_s", u"db")
        functionality2 = Functionality(u"__test_a", u"db1")
        functionality3 = Functionality(u"__test_a", u"db2")
        role2.functionalities = [
            functionality1, functionality2, functionality3
        ]

        DBSession.add_all([user1, user2, role1, role2])
        transaction.commit()

        engine = sqlahelper.get_engine()
        init(engine)
    def setup_method(self, _):
        import transaction
        from c2cgeoportal.models import DBSession, Role, User, Functionality

        create_default_ogcserver()
        role1 = Role(name="__test_role1")
        user1 = User(username="******",
                     password="******",
                     role=role1)
        role2 = Role(name="__test_role2")
        user2 = User(username="******",
                     password="******",
                     role=role2)

        functionality1 = Functionality("__test_s", "db")
        functionality2 = Functionality("__test_a", "db1")
        functionality3 = Functionality("__test_a", "db2")
        role2.functionalities = [
            functionality1, functionality2, functionality3
        ]

        DBSession.add_all([user1, user2, role1, role2])
        transaction.commit()