Beispiel #1
0
    def test_account_04(self):
        row = {}
        row['user_id'] = "testtaro"
        password = "******"
        row['user_name'] = ""
        row['email'] = "*****@*****.**"
        row['department'] = 'user'
        row['privs'] = 'admin'
        account = Account(row,password)

        def db_execute(db):
            (b,m) = account.validate(db, 'regist')
            self.assertEqual(b, False)
            self.assertEqual(m, "入力されていない項目があります。(全て必須項目です。)")

        t = JvnTest()
        do_transaction(db_execute, t)
Beispiel #2
0
    def test_account_16(self):
        row = {}
        row['user_id'] = "test_taro"
        password = "******"
        row['user_name'] = ("a" * 255)
        row['email'] = "testtaro"
        row['department'] = ("a" * 32)
        row['privs'] = ("a" * 8)
        account = Account(row,password)

        def db_execute(db):
            (b,m) = account.validate(db, 'regist')
            self.assertEqual(b, False)
            self.assertEqual(m, "メールアドレスの形式が正しくありません。")

        t = JvnTest()
        do_transaction(db_execute, t)
Beispiel #3
0
    def test_account_15(self):
        row = {}
        row['user_id'] = "admin"
        password = "******"
        row['user_name'] = ("a" * 255)
        row['email'] = "*****@*****.**"
        row['department'] = ("a" * 32)
        row['privs'] = ("a" * 8)
        account = Account(row,password)

        def db_execute(db):
            (b,m) = account.validate(db, 'regist')
            self.assertEqual(b, False)
            self.assertEqual(m, "既にアカウントが存在してます。")

        t = JvnTest()
        do_transaction(db_execute, t)
Beispiel #4
0
    def test_account_13(self):
        row = {}
        row['user_id'] = "testtaro"
        password = "******"
        row['user_name'] = ("a" * 255)
        row['email'] = "*****@*****.**"
        row['department'] = ("a" * 33)
        row['privs'] = 'admin'
        account = Account(row,password)

        def db_execute(db):
            (b,m) = account.validate(db, 'regist')
            self.assertEqual(b, False)
            self.assertEqual(m, "最大桁数をこえている項目があります。")

        t = JvnTest()
        do_transaction(db_execute, t)
Beispiel #5
0
    def do_logic(self, req, res, session):

        session[get_session_key(req)] = JvnState()

        self.jinja_html_file = 'jvn_account_edit.j2'
        self.ui = Account(
            {
                'user_id': '',
                'passwd': '',
                'user_name': '',
                'email': '',
                'department': '',
                'privs': ''
            }, '')

        self.readonly = ''
        self.method = 'regist'
        setPrivs(self, 'user')
Beispiel #6
0
        def do_execute(db):
            rec = Account(req.params, hash_code)
            ret, self.error_message = rec.validate(db, self.method)
            if ret == False:
                self.jinja_html_file = 'jvn_account_edit.j2'
                self.ui = rec
                setPrivs(self, rec.privs)
                return

            if self.method == 'regist':
                db.add(rec)

            elif self.method == 'modify':
                rec = db.query(Account).filter_by(
                    user_id=req.params['user_id']).first()
                rec.passwd = hash_code
                rec.user_name = req.params['user_name']
                rec.email = req.params['email']
                rec.department = req.params['department']
                rec.privs = req.params['privs']
            return db.query(Account).order_by(Account.user_id).all()