Exemplo n.º 1
0
    def test_create_with_default_caller_id(self):
        caller_id = '"firstname lastname"'
        user = self.prepare_user(firstname='firstname', lastname='lastname')

        created_user = user_dao.create(user)

        row = (self.session.query(UserSchema).filter(
            UserSchema.firstname == user.firstname).filter(
                UserSchema.lastname == user.lastname).first())

        assert_that(row.id, equal_to(created_user.id))
        assert_that(row.firstname, equal_to(user.firstname))
        assert_that(row.lastname, equal_to(user.lastname))
        assert_that(row.callerid, equal_to(caller_id))
Exemplo n.º 2
0
    def test_create_with_default_caller_id(self):
        caller_id = '"firstname lastname"'
        user = self.prepare_user(firstname='firstname',
                                 lastname='lastname')

        created_user = user_dao.create(user)

        row = (self.session.query(UserSchema)
               .filter(UserSchema.firstname == user.firstname)
               .filter(UserSchema.lastname == user.lastname)
               .first())

        assert_that(row.id, equal_to(created_user.id))
        assert_that(row.firstname, equal_to(user.firstname))
        assert_that(row.lastname, equal_to(user.lastname))
        assert_that(row.callerid, equal_to(caller_id))
Exemplo n.º 3
0
    def test_create_with_custom_caller_id_including_quotes(self):
        caller_id = '"caller_id"'
        user = self.prepare_user(firstname='firstname',
                                 lastname='lastname',
                                 caller_id='"caller_id"')

        created_user = user_dao.create(user)

        row = (self.session.query(UserSchema).filter(
            UserSchema.firstname == user.firstname).filter(
                UserSchema.lastname == user.lastname).first())

        assert_that(row.id, equal_to(created_user.id))
        assert_that(row.firstname, equal_to(user.firstname))
        assert_that(row.lastname, equal_to(user.lastname))
        assert_that(row.callerid, equal_to(caller_id))
Exemplo n.º 4
0
    def test_create_with_custom_caller_id_including_quotes(self):
        caller_id = '"caller_id"'
        user = self.prepare_user(firstname='firstname',
                                 lastname='lastname',
                                 caller_id='"caller_id"')

        created_user = user_dao.create(user)

        row = (self.session.query(UserSchema)
               .filter(UserSchema.firstname == user.firstname)
               .filter(UserSchema.lastname == user.lastname)
               .first())

        assert_that(row.id, equal_to(created_user.id))
        assert_that(row.firstname, equal_to(user.firstname))
        assert_that(row.lastname, equal_to(user.lastname))
        assert_that(row.callerid, equal_to(caller_id))
Exemplo n.º 5
0
    def test_create(self):
        user = self.prepare_user(firstname='toto',
                                 lastname='kiki',
                                 language='fr_FR',
                                 music_on_hold='musiconhold',
                                 preprocess_subroutine='preprocess_subroutine')

        created_user = user_dao.create(user)

        row = (self.session.query(UserSchema)
               .filter(UserSchema.firstname == user.firstname)
               .filter(UserSchema.lastname == user.lastname)
               .first())

        assert_that(row.id, equal_to(created_user.id))
        assert_that(row.firstname, equal_to(user.firstname))
        assert_that(row.lastname, equal_to(user.lastname))
        assert_that(row.language, equal_to(user.language))
        assert_that(row.musiconhold, equal_to(user.music_on_hold))
        assert_that(row.preprocess_subroutine, equal_to(user.preprocess_subroutine))
        assert_that(row.func_key_private_template_id, equal_to(user.private_template_id))
        assert_that(row.entityid, equal_to(self.entity.id))
Exemplo n.º 6
0
    def test_create(self):
        user = self.prepare_user(firstname='toto',
                                 lastname='kiki',
                                 language='fr_FR',
                                 music_on_hold='musiconhold',
                                 preprocess_subroutine='preprocess_subroutine')

        created_user = user_dao.create(user)

        row = (self.session.query(UserSchema).filter(
            UserSchema.firstname == user.firstname).filter(
                UserSchema.lastname == user.lastname).first())

        assert_that(row.id, equal_to(created_user.id))
        assert_that(row.firstname, equal_to(user.firstname))
        assert_that(row.lastname, equal_to(user.lastname))
        assert_that(row.language, equal_to(user.language))
        assert_that(row.musiconhold, equal_to(user.music_on_hold))
        assert_that(row.preprocess_subroutine,
                    equal_to(user.preprocess_subroutine))
        assert_that(row.func_key_private_template_id,
                    equal_to(user.private_template_id))
        assert_that(row.entityid, equal_to(self.entity.id))
Exemplo n.º 7
0
    def test_create_with_all_fields(self):
        caller_id = '"caller_id"'
        user = self.prepare_user(firstname='firstname',
                                 lastname='lastname',
                                 timezone='America/Montreal',
                                 language='en_US',
                                 description='description',
                                 caller_id='caller_id',
                                 outgoing_caller_id='outgoing_caller_id',
                                 mobile_phone_number='1234567890',
                                 username='******',
                                 password='******',
                                 music_on_hold='music_on_hold',
                                 preprocess_subroutine='preprocess_subroutine',
                                 userfield='userfield')

        created_user = user_dao.create(user)

        row = (self.session.query(UserSchema).filter(
            UserSchema.firstname == user.firstname).filter(
                UserSchema.lastname == user.lastname).first())

        assert_that(row.id, equal_to(created_user.id))
        assert_that(row.firstname, equal_to(user.firstname))
        assert_that(row.lastname, equal_to(user.lastname))
        assert_that(row.timezone, equal_to(user.timezone))
        assert_that(row.language, equal_to(user.language))
        assert_that(row.description, equal_to(user.description))
        assert_that(row.callerid, equal_to(caller_id))
        assert_that(row.outcallerid, equal_to(user.outgoing_caller_id))
        assert_that(row.mobilephonenumber, equal_to(user.mobile_phone_number))
        assert_that(row.loginclient, equal_to(user.username))
        assert_that(row.passwdclient, equal_to(user.password))
        assert_that(row.musiconhold, equal_to(user.music_on_hold))
        assert_that(row.preprocess_subroutine,
                    equal_to(user.preprocess_subroutine))
        assert_that(row.userfield, equal_to(user.userfield))
Exemplo n.º 8
0
    def test_create_with_all_fields(self):
        caller_id = '"caller_id"'
        user = self.prepare_user(firstname='firstname',
                                 lastname='lastname',
                                 timezone='America/Montreal',
                                 language='en_US',
                                 description='description',
                                 caller_id='caller_id',
                                 outgoing_caller_id='outgoing_caller_id',
                                 mobile_phone_number='1234567890',
                                 username='******',
                                 password='******',
                                 music_on_hold='music_on_hold',
                                 preprocess_subroutine='preprocess_subroutine',
                                 userfield='userfield')

        created_user = user_dao.create(user)

        row = (self.session.query(UserSchema)
               .filter(UserSchema.firstname == user.firstname)
               .filter(UserSchema.lastname == user.lastname)
               .first())

        assert_that(row.id, equal_to(created_user.id))
        assert_that(row.firstname, equal_to(user.firstname))
        assert_that(row.lastname, equal_to(user.lastname))
        assert_that(row.timezone, equal_to(user.timezone))
        assert_that(row.language, equal_to(user.language))
        assert_that(row.description, equal_to(user.description))
        assert_that(row.callerid, equal_to(caller_id))
        assert_that(row.outcallerid, equal_to(user.outgoing_caller_id))
        assert_that(row.mobilephonenumber, equal_to(user.mobile_phone_number))
        assert_that(row.loginclient, equal_to(user.username))
        assert_that(row.passwdclient, equal_to(user.password))
        assert_that(row.musiconhold, equal_to(user.music_on_hold))
        assert_that(row.preprocess_subroutine, equal_to(user.preprocess_subroutine))
        assert_that(row.userfield, equal_to(user.userfield))
Exemplo n.º 9
0
def _create_user_in_database(user):
    user.private_template_id = template_dao.create_private_template()
    user = user_dao.create(user)
    dial_action_dao.create_default_dial_actions_for_user(user)
    func_key_destination.create_user_destination(user)
    return user