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', '') ))
def create(context): validator.validate_create(context) created_context = context_dao.create(context) notifier.created(created_context) return created_context