Exemple #1
0
    def test_05_add_user_update_delete(self):
        y = SQLResolver()
        y.loadConfig(self.parameters)
        uid = y.add_user({
            "username": "******",
            "email": "*****@*****.**",
            "mobile": "12345"
        })
        self.assertTrue(uid > 6)

        uid = y.getUserId("achmed")
        self.assertTrue(uid > 6)

        r = y.update_user(uid, {"username": "******", "password": "******"})
        uname = y.getUsername(uid)
        self.assertEqual(uname, "achmed2")
        r = y.checkPass(uid, "test")
        self.assertTrue(r)
        # Now we delete the user
        y.delete_user(uid)
        # Now there should be no achmed anymore
        uid = y.getUserId("achmed2")
        self.assertFalse(uid)
        uid = y.getUserId("achmed")
        self.assertFalse(uid)
Exemple #2
0
    def test_01_sqlite_resolver(self):
        y = SQLResolver()
        y.loadConfig(self.parameters)

        userlist = y.getUserList()
        self.assertTrue(len(userlist) == 6, len(userlist))

        user = "******"
        user_id = y.getUserId(user)
        self.assertTrue(user_id == 3, user_id)

        rid = y.getResolverId()
        self.assertTrue(rid == "sql.testuser.sqlite", rid)

        rtype = y.getResolverType()
        self.assertTrue(rtype == "sqlresolver", rtype)

        rdesc = y.getResolverClassDescriptor()
        rdesc = y.getResolverDescriptor()
        self.assertTrue("sqlresolver" in rdesc, rdesc)
        self.assertTrue("config" in rdesc.get("sqlresolver"), rdesc)
        self.assertTrue("clazz" in rdesc.get("sqlresolver"), rdesc)

        uinfo = y.getUserInfo(user_id)
        self.assertTrue(uinfo.get("username") == "cornelius", uinfo)

        ret = y.getUserList({"username": "******"})
        self.assertTrue(len(ret) == 1, ret)

        username = y.getUsername(user_id)
        self.assertTrue(username == "cornelius", username)
    def test_01_sqlite_resolver(self):
        y = SQLResolver()
        y.loadConfig(self.parameters)

        userlist = y.getUserList()
        self.assertTrue(len(userlist) == 6, len(userlist))

        user = "******"
        user_id = y.getUserId(user)
        self.assertTrue(user_id == 3, user_id)

        rid = y.getResolverId()
        self.assertTrue(rid == "sql.testuser.sqlite", rid)

        rtype = y.getResolverType()
        self.assertTrue(rtype == "sqlresolver", rtype)

        rdesc = y.getResolverClassDescriptor()
        rdesc = y.getResolverDescriptor()
        self.assertTrue("sqlresolver" in rdesc, rdesc)
        self.assertTrue("config" in rdesc.get("sqlresolver"), rdesc)
        self.assertTrue("clazz" in rdesc.get("sqlresolver"), rdesc)

        uinfo = y.getUserInfo(user_id)
        self.assertTrue(uinfo.get("username") == "cornelius", uinfo)

        ret = y.getUserList({"username": "******"})
        self.assertTrue(len(ret) == 1, ret)

        username = y.getUsername(user_id)
        self.assertTrue(username == "cornelius", username)
 def test_00_delete_users(self):
     # If the test failed and some users are still in the database (from
     #  add_user) we delete them here.
     y = SQLResolver()
     y.loadConfig(self.parameters)
     for username in self.usernames:
         uid = y.getUserId(username)
         y.delete_user(uid)
 def test_00_delete_users(self):
     # If the test failed and some users are still in the database (from
     #  add_user) we delete them here.
     y = SQLResolver()
     y.loadConfig(self.parameters)
     for username in self.usernames:
         uid = y.getUserId(username)
         y.delete_user(uid)
Exemple #6
0
 def test_00_delete_achmeds(self):
     # If the test failed and some achmeds are still in the database (from
     #  add_user) we delete them here.
     y = SQLResolver()
     y.loadConfig(self.parameters)
     for username in ["achmed", "achmed2", "corneliusReg"]:
         uid = True
         while uid:
             uid = y.getUserId(username)
             y.delete_user(uid)
 def test_00_delete_achmeds(self):
     # If the test failed and some achmeds are still in the database (from
     #  add_user) we delete them here.
     y = SQLResolver()
     y.loadConfig(self.parameters)
     for username in ["achmed", "achmed2"]:
         uid = True
         while uid:
             uid = y.getUserId(username)
             y.delete_user(uid)
    def test_05_add_user_update_delete(self):
        y = SQLResolver()
        y.loadConfig(self.parameters)
        uid = y.add_user({"username": "******", "email": "*****@*****.**", "mobile": "12345"})
        self.assertTrue(uid > 6)

        uid = y.getUserId("achmed")
        self.assertTrue(uid > 6)

        r = y.update_user(uid, {"username": "******", "password": "******"})
        uname = y.getUsername(uid)
        self.assertEqual(uname, "achmed2")
        r = y.checkPass(uid, "test")
        self.assertTrue(r)
        # Now we delete the user
        y.delete_user(uid)
        # Now there should be no achmed anymore
        uid = y.getUserId("achmed2")
        self.assertFalse(uid)
        uid = y.getUserId("achmed")
        self.assertFalse(uid)