def test_find_by_exten_context_one_extension(self): exten = 'sdklfj' context = 'toto' extension_row = self.add_extension(exten=exten, context=context) result = extension_dao.find_by_exten_context(exten, context) assert_that( result, all_of(has_property('id', extension_row.id), has_property('exten', exten), has_property('context', context)))
def test_find_by_exten_context_one_extension(self): exten = 'sdklfj' context = 'toto' extension_row = self.add_extension(exten=exten, context=context) result = extension_dao.find_by_exten_context(exten, context) assert_that(result, all_of( has_property('id', extension_row.id), has_property('exten', exten), has_property('context', context) ))
def test_find_by_exten_context_no_extensions(self): expected = None result = extension_dao.find_by_exten_context('1000', 'default') assert_that(expected, equal_to(result))
def validate_extension_available(extension): existing_extension = extension_dao.find_by_exten_context(extension.exten, extension.context) if existing_extension: raise errors.resource_exists('Extension', exten=extension.exten, context=extension.context)
def validate_extension_available(extension): existing_extension = extension_dao.find_by_exten_context(extension.exten, extension.context) if existing_extension: exten_context = '%s@%s' % (extension.exten, extension.context) raise ElementAlreadyExistsError('Extension', exten_context)
def validate_extension_available(extension): existing_extension = extension_dao.find_by_exten_context( extension.exten, extension.context) if existing_extension: exten_context = '%s@%s' % (extension.exten, extension.context) raise ElementAlreadyExistsError('Extension', exten_context)