Esempio n. 1
0
def add_user(session, user):
    user.func_key_private_template_id = func_key_template_dao.create_private_template()

    try:
        session.begin()
        session.add(user)
        session.commit()
    except Exception as e:
        session.rollback()
        raise e
Esempio n. 2
0
def add_user(session, user):
    user.func_key_private_template_id = func_key_template_dao.create_private_template(
    )

    try:
        session.begin()
        session.add(user)
        session.commit()
    except Exception as e:
        session.rollback()
        raise e
Esempio n. 3
0
    def test_given_database_error_then_transaction_aborted(self, commit_or_abort):
        dao.create_private_template()

        commit_or_abort.assert_called_with(ANY, DataError.on_create, 'FuncKeyTemplate')
Esempio n. 4
0
    def test_create_private_template(self):
        template_id = dao.create_private_template()

        self.assert_private_template_created(template_id)
Esempio n. 5
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
Esempio n. 6
0
    def test_given_database_error_then_transaction_aborted(self, commit_or_abort):
        dao.create_private_template()

        commit_or_abort.assert_called_with(ANY, ElementCreationError, 'FuncKeyTemplate')
Esempio n. 7
0
    def test_create_private_template(self):
        template_id = dao.create_private_template()

        self.assert_private_template_created(template_id)