Beispiel #1
0
    def test_add(self):
        fwd_unc = PhoneFunckey()
        fwd_unc.iduserfeatures = self._user_id
        fwd_unc.fknum = 9
        fwd_unc.exten = self._destination_unc
        fwd_unc.typeextenumbers = 'extenfeatures'
        fwd_unc.typevalextenumbers = 'fwdunc'
        fwd_unc.supervision = 1
        fwd_unc.progfunckey = 1
        fwd_unc.label = 'my label for test_add'

        phonefunckey_dao.add(fwd_unc)
        new_funckey = (self.session.query(PhoneFunckey)
                           .filter(PhoneFunckey.label == 'my label for test_add')
                           .first())
        self.assertEquals(fwd_unc, new_funckey)
Beispiel #2
0
    def add_function_key_to_user(self, **kwargs):
        kwargs.setdefault('iduserfeatures', self._generate_int())
        kwargs.setdefault('fknum', ''.join(random.choice('123456789') for _ in range(6)))
        kwargs.setdefault('exten', ''.join(random.choice('0123456789_*X.') for _ in range(6)))
        kwargs.setdefault('supervision', '0')
        kwargs.setdefault('label', 'toto')
        kwargs.setdefault('typeextenumbersright', 'user')
        kwargs.setdefault('typeextenumbers', None)
        kwargs.setdefault('typevalextenumbers', None)
        kwargs.setdefault('progfunckey', '1')

        phone_func_key = PhoneFunckey(**kwargs)
        self.add_me(phone_func_key)
        return phone_func_key
Beispiel #3
0
 def _add_function_key_to_user(self, userid):
     key = PhoneFunckey(iduserfeatures=userid,
                        fknum=1,
                        typeextenumbersright='user')
     self.add_me(key)
Beispiel #4
0
    def _insert_funckeys(self):
        fwd_unc = PhoneFunckey()
        fwd_unc.iduserfeatures = self._user_id
        fwd_unc.fknum = 2
        fwd_unc.exten = self._destination_unc
        fwd_unc.typeextenumbers = 'extenfeatures'
        fwd_unc.typevalextenumbers = 'fwdunc'
        fwd_unc.supervision = 1
        fwd_unc.progfunckey = 1

        fwd_unc_no_dest = PhoneFunckey()
        fwd_unc_no_dest.iduserfeatures = self._user_id_no_dest
        fwd_unc_no_dest.fknum = 2
        fwd_unc_no_dest.typeextenumbers = 'extenfeatures'
        fwd_unc_no_dest.typevalextenumbers = 'fwdunc'
        fwd_unc_no_dest.supervision = 1
        fwd_unc_no_dest.progfunckey = 1

        fwd_rna = PhoneFunckey()
        fwd_rna.iduserfeatures = self._user_id
        fwd_rna.fknum = 3
        fwd_rna.exten = self._destination_rna
        fwd_rna.typeextenumbers = 'extenfeatures'
        fwd_rna.typevalextenumbers = 'fwdrna'
        fwd_rna.supervision = 1
        fwd_rna.progfunckey = 1

        self.session.begin()
        self.session.add(fwd_unc)
        self.session.add(fwd_unc_no_dest)
        self.session.add(fwd_rna)
        self.session.commit()