コード例 #1
0
ファイル: test_dao.py プロジェクト: jaunis/xivo-dao
    def test_create(self):
        entity_name = 'testentity'
        context_name = 'contextname'
        context_type = ContextType.internal

        context = Context(name=context_name,
                          display_name=context_name,
                          type=context_type)

        self.add_entity(name=entity_name)

        created_context = context_dao.create(context)

        context_row = self.session.query(ContextSchema).filter(ContextSchema.name == context_name).first()

        assert_that(created_context, instance_of(Context))

        assert_that(context_row, all_of(
            has_property('name', context_name),
            has_property('displayname', context_name),
            has_property('entity', entity_name),
            has_property('contexttype', context_type),
            has_property('commented', 0),
            has_property('description', '')
        ))
コード例 #2
0
ファイル: services.py プロジェクト: jaunis/xivo-dao
def create(context):
    validator.validate_create(context)
    created_context = context_dao.create(context)
    notifier.created(created_context)
    return created_context
コード例 #3
0
ファイル: services.py プロジェクト: jlebleu/xivo-dao
def create(context):
    validator.validate_create(context)
    created_context = context_dao.create(context)
    notifier.created(created_context)
    return created_context