def test_given_db_error_then_transaction_rollbacked(self, commit_or_abort, session_maker): session = session_maker.return_value func_key = FuncKey(type='speeddial', destination='user', destination_id=1) dao.create(func_key) commit_or_abort.assert_any_call(session, DataError.on_create, 'FuncKey')
def test_given_db_error_then_transaction_rollbacked( self, commit_or_abort, session_maker): session = session_maker.return_value func_key = FuncKey(type='speeddial', destination='user', destination_id=1) dao.create(func_key) commit_or_abort.assert_any_call(session, ElementCreationError, 'FuncKey')
def test_given_queue_destination_then_func_key_created(self): queue_row = self.add_queuefeatures() func_key = FuncKey(type='speeddial', destination='queue', destination_id=queue_row.id) created_func_key = dao.create(func_key) assert_that(created_func_key, instance_of(FuncKey)) assert_that(created_func_key, has_property('id', is_not(none()))) queue_destination_row = self.find_destination('queue', queue_row.id) assert_that(queue_destination_row, is_not(none())) self.assert_func_key_row_created(queue_destination_row)
def test_given_group_destination_then_func_key_created(self): group_row = self.add_group() func_key = FuncKey(type='speeddial', destination='group', destination_id=group_row.id) created_func_key = dao.create(func_key) assert_that(created_func_key, instance_of(FuncKey)) assert_that(created_func_key, has_property('id', is_not(none()))) group_destination_row = self.find_destination('group', group_row.id) assert_that(group_destination_row, is_not(none())) self.assert_func_key_row_created(group_destination_row)
def test_given_user_destination_then_func_key_created(self): user_row = self.add_user() func_key = FuncKey(type='speeddial', destination='user', destination_id=user_row.id) created_func_key = dao.create(func_key) assert_that(created_func_key, instance_of(FuncKey)) assert_that(created_func_key, has_property('id', is_not(none()))) user_destination_row = self.find_destination('user', user_row.id) assert_that(user_destination_row, is_not(none())) self.assert_func_key_row_created(user_destination_row)
def test_given_conference_destination_then_func_key_created(self): conference_row = self.add_meetmefeatures() func_key = FuncKey(type='speeddial', destination='conference', destination_id=conference_row.id) created_func_key = dao.create(func_key) assert_that(created_func_key, instance_of(FuncKey)) assert_that(created_func_key, has_property('id', is_not(none()))) conference_destination_row = self.find_destination('conference', conference_row.id) assert_that(conference_destination_row, is_not(none())) self.assert_func_key_row_created(conference_destination_row)
def test_given_conference_destination_then_func_key_created(self): conference_row = self.add_meetmefeatures() func_key = FuncKey(type='speeddial', destination='conference', destination_id=conference_row.id) created_func_key = dao.create(func_key) assert_that(created_func_key, instance_of(FuncKey)) assert_that(created_func_key, has_property('id', is_not(none()))) conference_destination_row = self.find_destination( 'conference', conference_row.id) assert_that(conference_destination_row, is_not(none())) self.assert_func_key_row_created(conference_destination_row)
def test_given_service_destination_then_func_key_created(self): service_row = self.add_extension(type='extenfeatures', context='xivo-features', typeval='vmusermsg') func_key = FuncKey(type='speeddial', destination='service', destination_id=service_row.id) created_func_key = dao.create(func_key) assert_that(created_func_key, instance_of(FuncKey)) assert_that(created_func_key, has_property('id', is_not(none()))) service_destination_row = self.find_destination('service', service_row.id) assert_that(service_destination_row, is_not(none())) self.assert_func_key_row_created(service_destination_row)
def test_given_service_destination_then_func_key_created(self): service_row = self.add_extension(type='extenfeatures', context='xivo-features', typeval='vmusermsg') func_key = FuncKey(type='speeddial', destination='service', destination_id=service_row.id) created_func_key = dao.create(func_key) assert_that(created_func_key, instance_of(FuncKey)) assert_that(created_func_key, has_property('id', is_not(none()))) service_destination_row = self.find_destination( 'service', service_row.id) assert_that(service_destination_row, is_not(none())) self.assert_func_key_row_created(service_destination_row)
def create(func_key): validator.validate_create(func_key) created_func_key = dao.create(func_key) notifier.created(created_func_key) return created_func_key
def create_user_destination(user): func_key = FuncKey(type='speeddial', destination='user', destination_id=user.id) func_key_dao.create(func_key)