Пример #1
0
 def test_add_user(self):
     Session = sessionmaker(bind=Database.create_sqlalchemy_engine())
     session = Session()
     self.assertFalse(User.check_user_account_exist(session=session, user_id="apple"))
     User.add_user_account(session=session, user_id="apple", password="******")
     self.assertTrue(User.check_user_account_exist(session=session, user_id="apple"))
     self.assertTrue(User.check_user_account_password(session=session, user_id="apple", password="******"))
     session.close()
Пример #2
0
    def test_remove_user(self):
        cleanup = Cleanup()
        session = Database.create_sqlalchemy_session_push(cleanup)

        self.assertFalse(User.check_user_account_exist(session=session, user_id="apple"))
        User.add_user_account(session=session, user_id="apple", password="******")
        self.assertTrue(User.check_user_account_exist(session=session, user_id="apple"))
        User.remove_user_account(session=session, user_id="apple")
        self.assertFalse(User.check_user_account_exist(session=session, user_id="apple"))
Пример #3
0
 def test_owner(self):
     cleanup = Cleanup()
     session = Database.create_sqlalchemy_session_push(cleanup)
     
     self.assertTrue(User.check_user_account_exist(session,_testcommon.OWNER_USERNAME))
     self.assertTrue(User.check_user_account_password(session,_testcommon.OWNER_USERNAME,_testcommon.OWNER_PASSWORD))
     self.assertTrue(UserGroup.get_group(session,_testcommon.OWNER_USERNAME),["owner"])
     self.assertTrue(Permission.get_user_permission(session, _testcommon.OWNER_USERNAME, "admin"))