Example #1
0
    def test_create_same_exten_and_context(self):
        exten = 'extension'
        context = 'toto'

        extension = Extension(exten=exten, context=context)

        extension_dao.create(extension)

        extension = Extension(exten=exten, context=context)

        self.assertRaises(ElementCreationError, extension_dao.create,
                          extension)
Example #2
0
    def test_create_same_exten_and_context(self):
        exten = 'extension'
        context = 'toto'

        extension = Extension(exten=exten,
                              context=context)

        extension_dao.create(extension)

        extension = Extension(exten=exten,
                              context=context)

        self.assertRaises(DataError, extension_dao.create, extension)
Example #3
0
    def test_create(self):
        exten = 'extension'
        context = 'toto'
        commented = True

        extension = Extension(exten=exten,
                              context=context,
                              commented=commented)

        created_extension = extension_dao.create(extension)

        row = self.session.query(ExtensionSchema).filter(ExtensionSchema.id == created_extension.id).first()

        assert_that(row.id, equal_to(created_extension.id))
        assert_that(row.exten, equal_to(exten))
        assert_that(row.context, equal_to(context))
        assert_that(row.commented, equal_to(1))
        assert_that(row.type, equal_to('user'))
        assert_that(row.typeval, equal_to('0'))
Example #4
0
    def test_create(self):
        exten = 'extension'
        context = 'toto'
        commented = True

        extension = Extension(exten=exten,
                              context=context,
                              commented=commented)

        created_extension = extension_dao.create(extension)

        row = self.session.query(ExtensionSchema).filter(
            ExtensionSchema.id == created_extension.id).first()

        assert_that(row.id, equal_to(created_extension.id))
        assert_that(row.exten, equal_to(exten))
        assert_that(row.context, equal_to(context))
        assert_that(row.commented, equal_to(1))
        assert_that(row.type, equal_to('user'))
        assert_that(row.typeval, equal_to('0'))