当前位置: 首页>>代码示例>>Python>>正文


Python SourceVersion.get_latest_version_of方法代码示例

本文整理汇总了Python中sources.models.SourceVersion.get_latest_version_of方法的典型用法代码示例。如果您正苦于以下问题:Python SourceVersion.get_latest_version_of方法的具体用法?Python SourceVersion.get_latest_version_of怎么用?Python SourceVersion.get_latest_version_of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sources.models.SourceVersion的用法示例。


在下文中一共展示了SourceVersion.get_latest_version_of方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_persist_new_positive__earlier_source_version

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_persist_new_positive__earlier_source_version(self):
        version1 = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(0, len(version1.mappings))

        version2 = SourceVersion.for_base_object(self.source1, label='version2')
        version2.save()
        self.assertEquals(0, len(version2.mappings))

        source_version = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(0, len(source_version.mappings))

        mapping = Mapping(
            map_type='Same As',
            from_concept=self.concept1,
            to_concept=self.concept2,
            external_id='mapping1',
        )
        kwargs = {
            'parent_resource': self.source1,
            'parent_resource_version': version1,
        }

        errors = Mapping.persist_new(mapping, self.user1, **kwargs)
        self.assertEquals(0, len(errors))
        self.assertTrue(Mapping.objects.filter(external_id='mapping1').exists())
        mapping = Mapping.objects.get(external_id='mapping1')

        version1 = SourceVersion.objects.get(id=version1.id)
        self.assertEquals(1, len(version1.mappings))
        self.assertTrue(MappingVersion.objects.get(versioned_object_id=mapping.id).id in version1.mappings)

        version2 = SourceVersion.objects.get(id=version2.id)
        self.assertEquals(0, len(version2.mappings))
        latest_version = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(0, len(latest_version.mappings))
开发者ID:AnshuAg,项目名称:oclapi,代码行数:37,代码来源:tests.py

示例2: test_retire_positive

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_retire_positive(self):
        source_version = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(0, len(source_version.concepts))
        concept = Concept(
            mnemonic='concept1',
            created_by=self.user1,
            updated_by=self.user1,
            parent=self.source1,
            concept_class='First',
            names=[self.name],
        )
        kwargs = {
            'parent_resource': self.source1,
        }
        errors = Concept.persist_new(concept, self.user1, **kwargs)
        self.assertEquals(0, len(errors))
        self.assertTrue(Concept.objects.filter(mnemonic='concept1').exists())
        self.assertFalse(concept.retired)
        self.assertEquals(1, concept.num_versions)

        concept_version = ConceptVersion.get_latest_version_of(concept)
        self.assertTrue(concept_version.is_latest_version)
        self.assertFalse(concept_version.retired)

        source_version = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(1, len(source_version.concepts))
        self.assertEquals(concept_version.id, source_version.concepts[0])

        errors = Concept.retire(concept, self.user1)
        self.assertFalse(errors)
        self.assertTrue(Concept.objects.filter(mnemonic='concept1').exists())
        self.assertTrue(concept.retired)
        self.assertEquals(2, concept.num_versions)

        previous_version = ConceptVersion.objects.get(id=concept_version.id)
        self.assertFalse(previous_version.is_latest_version)
        self.assertFalse(previous_version.retired)

        concept_version = ConceptVersion.get_latest_version_of(concept)
        self.assertTrue(concept_version.is_latest_version)
        self.assertTrue(concept_version.retired)
        self.assertEquals(self.user1.username, concept_version.version_created_by)

        source_version = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(1, len(source_version.concepts))
        self.assertEquals(concept_version.id, source_version.concepts[0])

        self.assertEquals(
            1, ConceptVersion.objects.filter(versioned_object_id=concept.id, retired=True).count())
        self.assertEquals(
            1, ConceptVersion.objects.filter(versioned_object_id=concept.id, retired=False).count())

        errors = Concept.retire(concept, self.user1)
        self.assertEquals(1, len(errors))
开发者ID:AnjaliWadhwa,项目名称:oclapi,代码行数:56,代码来源:tests.py

示例3: test_persist_changes_positive__seed_from_previous_over_parent

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_persist_changes_positive__seed_from_previous_over_parent(self):
        version1 = SourceVersion.for_base_object(self.source1, 'version1')
        version1.concepts = [1]
        version1.full_clean()
        version1.save()

        version2 = SourceVersion.for_base_object(self.source1, 'version2')
        version2.concepts = [2]
        version2.full_clean()
        version2.save()
        self.assertIsNone(version2.previous_version)

        version3 = SourceVersion.for_base_object(self.source1, 'version3')
        version3.full_clean()
        version3.save()

        mnemonic = version3.mnemonic
        released = version3.released
        description = version3.description
        external_id = version3.external_id

        id = version3.id
        version3._parent_version_mnemonic = 'version2'
        version3._previous_version_mnemonic = 'version1'
        version3.mnemonic = "%s-prime" % mnemonic
        version3.released = not released
        version3.description = "%s-prime" % description
        version3.external_id = "%s-prime" % external_id

        errors = SourceVersion.persist_changes(version3)
        self.assertEquals(0, len(errors))

        version3 = SourceVersion.objects.get(id=id)
        self.assertEquals(self.source1, version3.versioned_object)
        self.assertEquals(3, self.source1.num_versions)
        self.assertEquals(version3, SourceVersion.get_latest_version_of(self.source1))
        self.assertEquals(version1, version3.previous_version)
        self.assertEquals(version2, version3.parent_version)
        self.assertEquals([], version3.concepts)
        self.assertNotEquals(mnemonic, version3.mnemonic)
        self.assertNotEquals(released, version3.released)
        self.assertNotEquals(description, version3.description)
        self.assertNotEquals(external_id, version3.external_id)

        errors = SourceVersion.persist_changes(version3, seed_concepts=True)
        self.assertEquals(0, len(errors))

        version3 = SourceVersion.objects.get(id=id)
        self.assertEquals(self.source1, version3.versioned_object)
        self.assertEquals(3, self.source1.num_versions)
        self.assertEquals(version3, SourceVersion.get_latest_version_of(self.source1))
        self.assertEquals(version2, version3.parent_version)
        self.assertEquals(version1, version3.previous_version)
        self.assertEquals([1], version3.concepts)
开发者ID:rkorytkowski,项目名称:oclapi,代码行数:56,代码来源:tests.py

示例4: test_persist_new_positive

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_persist_new_positive(self):
        mapping = Mapping(
            map_type='Same As',
            from_concept=self.concept1,
            to_concept=self.concept2,
            external_id='mapping1',
        )
        source_version = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(0, len(source_version.mappings))
        kwargs = {
            'parent_resource': self.source1,
        }
        errors = Mapping.persist_new(mapping, self.user1, **kwargs)
        self.assertEquals(0, len(errors))

        self.assertTrue(Mapping.objects.filter(external_id='mapping1').exists())
        mapping = Mapping.objects.get(external_id='mapping1')
        self.assertEquals(self.source1.public_access, mapping.public_access)
        self.assertEquals('user1', mapping.created_by)
        self.assertEquals('user1', mapping.updated_by)
        self.assertEquals(self.source1, mapping.parent)
        self.assertEquals('Same As', mapping.map_type)
        self.assertEquals(self.concept1, mapping.from_concept)
        self.assertEquals(self.concept2, mapping.to_concept)
        self.assertEquals(self.source1, mapping.from_source)
        self.assertEquals(self.source1.owner_name, mapping.from_source_owner)
        self.assertEquals(self.source1.mnemonic, mapping.from_source_name)
        self.assertEquals(self.source1, mapping.get_to_source())
        self.assertEquals(self.source1.owner_name, mapping.to_source_owner)
        self.assertEquals(self.concept2.mnemonic, mapping.get_to_concept_code())
        self.assertEquals(self.concept2.display_name, mapping.get_to_concept_name())

        source_version = SourceVersion.objects.get(id=source_version.id)
        self.assertEquals(1, len(source_version.mappings))
        self.assertTrue(MappingVersion.objects.get(versioned_object_id=mapping.id).id in source_version.mappings)
开发者ID:AnshuAg,项目名称:oclapi,代码行数:37,代码来源:tests.py

示例5: test_edit_mapping_make_new_version_positive

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_edit_mapping_make_new_version_positive(self):
        mapping1 = Mapping(
            map_type='Same As',
            from_concept=self.concept1,
            to_concept=self.concept2,
            external_id='mapping1',
        )
        source_version = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(0, len(source_version.mappings))
        kwargs = {
            'parent_resource': self.source1,
        }
        errors = Mapping.persist_new(mapping1, self.user1, **kwargs)
        self.assertEquals(0, len(errors))

        self.assertEquals(1,len(MappingVersion.objects.filter(versioned_object_id=mapping1.id)))

        mapping1.map_type='BROADER_THAN'
        Mapping.persist_changes(mapping1, self.user1)

        self.assertEquals(2, len(MappingVersion.objects.filter(versioned_object_id=mapping1.id)))

        old_version = MappingVersion.objects.get(versioned_object_id=mapping1.id, is_latest_version=False)

        new_version= MappingVersion.objects.get(versioned_object_id=mapping1.id, is_latest_version=True)

        self.assertFalse(old_version.is_latest_version)
        self.assertTrue(new_version.is_latest_version)
        self.assertEquals(new_version.map_type,'BROADER_THAN')
        self.assertEquals(old_version.map_type,'Same As')
开发者ID:AnshuAg,项目名称:oclapi,代码行数:32,代码来源:tests.py

示例6: test_source_version_create_positive__child_and_subsequent_versions

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_source_version_create_positive__child_and_subsequent_versions(self):
        version1 = SourceVersion(
            name='version1',
            mnemonic='version1',
            versioned_object=self.source1,
            released=True,
            created_by=self.user1,
            updated_by=self.user1,
        )
        version1.full_clean()
        version1.save()
        self.assertTrue(SourceVersion.objects.filter(
            mnemonic='version1',
            versioned_object_type=ContentType.objects.get_for_model(Source),
            versioned_object_id=self.source1.id
        ).exists())
        self.assertEquals(version1, SourceVersion.get_latest_version_of(self.source1))
        self.assertEquals(1, self.source1.num_versions)

        version2 = SourceVersion(
            name='version2',
            mnemonic='version2',
            versioned_object=self.source1,
            parent_version=version1,
            created_by=self.user1,
            updated_by=self.user1,
        )
        version2.full_clean()
        version2.save()
        self.assertTrue(SourceVersion.objects.filter(
            mnemonic='version2',
            versioned_object_type=ContentType.objects.get_for_model(Source),
            versioned_object_id=self.source1.id
        ).exists())
        self.assertEquals(version1, version2.parent_version)
        self.assertEquals(version1.mnemonic, version2.parent_version_mnemonic)
        self.assertIsNone(version2.previous_version)
        self.assertIsNone(version2.previous_version_mnemonic)
        self.assertEquals(2, self.source1.num_versions)

        version3 = SourceVersion(
            name='version3',
            mnemonic='version3',
            versioned_object=self.source1,
            previous_version=version2,
            created_by=self.user1,
            updated_by=self.user1,
        )
        version3.full_clean()
        version3.save()
        self.assertTrue(SourceVersion.objects.filter(
            mnemonic='version3',
            versioned_object_type=ContentType.objects.get_for_model(Source),
            versioned_object_id=self.source1.id
        ).exists())
        self.assertEquals(version2, version3.previous_version)
        self.assertEquals(version2.mnemonic, version3.previous_version_mnemonic)
        self.assertIsNone(version3.parent_version)
        self.assertIsNone(version3.parent_version_mnemonic)
        self.assertEquals(3, self.source1.num_versions)
开发者ID:rkorytkowski,项目名称:oclapi,代码行数:62,代码来源:tests.py

示例7: test_persist_persist_changes_positive

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_persist_persist_changes_positive(self):
        mapping = Mapping(
            map_type='Same As',
            from_concept=self.concept1,
            to_concept=self.concept2,
            external_id='mapping1',
        )
        source_version = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(0, len(source_version.mappings))
        kwargs = {
            'parent_resource': self.source1,
        }
        Mapping.persist_new(mapping, self.user1, **kwargs)
        mapping = Mapping.objects.get(external_id='mapping1')
        to_concept = mapping.to_concept

        source_version = SourceVersion.objects.get(id=source_version.id)
        self.assertEquals(1, len(source_version.mappings))
        self.assertTrue(MappingVersion.objects.get(versioned_object_id=mapping.id).id in source_version.mappings)

        mapping.to_concept = self.concept3
        errors = Mapping.persist_changes(mapping, self.user1)
        self.assertEquals(0, len(errors))
        mapping = Mapping.objects.get(external_id='mapping1')

        self.assertEquals(self.concept3, mapping.to_concept)
        self.assertNotEquals(to_concept, mapping.to_concept)

        source_version = SourceVersion.objects.get(id=source_version.id)
        self.assertEquals(1, len(source_version.mappings))
        mv  = MappingVersion.objects.filter(versioned_object_id=mapping.id)
        self.assertTrue(mv[1].id in source_version.mappings)
开发者ID:AnshuAg,项目名称:oclapi,代码行数:34,代码来源:tests.py

示例8: test_persist_changes_negative__parent_version_is_self

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_persist_changes_negative__parent_version_is_self(self):
        version1 = SourceVersion.for_base_object(self.source1, 'version1', released=True)
        version1.full_clean()
        version1.save()

        mnemonic = version1.mnemonic
        released = version1.released
        description = version1.description
        external_id = version1.external_id

        id = version1.id
        version1._parent_version_mnemonic = mnemonic
        version1.released = not released
        version1.description = "%s-prime" % description
        version1.external_id = "%s-prime" % external_id

        errors = SourceVersion.persist_changes(version1)
        self.assertEquals(1, len(errors))
        self.assertTrue('parentVersion' in errors)

        version1 = SourceVersion.objects.get(id=id)
        self.assertEquals(self.source1, version1.versioned_object)
        self.assertEquals(1, self.source1.num_versions)
        self.assertEquals(version1, SourceVersion.get_latest_version_of(self.source1))
        self.assertEquals(mnemonic, version1.mnemonic)
        self.assertEquals(released, version1.released)
        self.assertEquals(description, version1.description)
        self.assertEquals(external_id, version1.external_id)
开发者ID:rkorytkowski,项目名称:oclapi,代码行数:30,代码来源:tests.py

示例9: test_persist_changes_positive__good_parent_version

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_persist_changes_positive__good_parent_version(self):
        version1 = SourceVersion.for_base_object(self.source1, 'version1')
        version1.full_clean()
        version1.save()

        version2 = SourceVersion.for_base_object(self.source1, 'version2')
        version2.full_clean()
        version2.save()
        self.assertIsNone(version2.parent_version)

        mnemonic = version2.mnemonic
        released = version2.released
        description = version2.description
        external_id = version2.external_id

        id = version2.id
        version2._parent_version_mnemonic = 'version1'
        version2.mnemonic = "%s-prime" % mnemonic
        version2.released = not released
        version2.description = "%s-prime" % description
        version2.external_id = "%s-prime" % external_id

        errors = SourceVersion.persist_changes(version2)
        self.assertEquals(0, len(errors))

        version2 = SourceVersion.objects.get(id=id)
        self.assertEquals(self.source1, version2.versioned_object)
        self.assertEquals(2, self.source1.num_versions)
        self.assertEquals(version2, SourceVersion.get_latest_version_of(self.source1))
        self.assertEquals(version1, version2.parent_version)
        self.assertNotEquals(mnemonic, version2.mnemonic)
        self.assertNotEquals(released, version2.released)
        self.assertNotEquals(description, version2.description)
        self.assertNotEquals(external_id, version2.external_id)
开发者ID:rkorytkowski,项目名称:oclapi,代码行数:36,代码来源:tests.py

示例10: test_source_version_create_positive

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_source_version_create_positive(self):
        source_version = SourceVersion(
            name='version1',
            mnemonic='version1',
            versioned_object=self.source1,
            released=True,
            created_by=self.user1,
            updated_by=self.user1,
        )
        source_version.full_clean()
        source_version.save()
        self.assertTrue(SourceVersion.objects.filter(
            mnemonic='version1',
            versioned_object_type=ContentType.objects.get_for_model(Source),
            versioned_object_id=self.source1.id
        ).exists())

        self.assertIsNone(source_version.previous_version)
        self.assertIsNone(source_version.previous_version_mnemonic)
        self.assertIsNone(source_version.parent_version)
        self.assertIsNone(source_version.parent_version_mnemonic)

        self.assertEquals(self.org1.mnemonic, source_version.parent_resource)
        self.assertEquals(self.org1.resource_type, source_version.parent_resource_type)

        self.assertEquals(source_version, SourceVersion.get_latest_version_of(self.source1))
        self.assertEquals(1, self.source1.num_versions)
开发者ID:rkorytkowski,项目名称:oclapi,代码行数:29,代码来源:tests.py

示例11: test_persist_persist_changes_negative__no_updated_by

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_persist_persist_changes_negative__no_updated_by(self):
        mapping = Mapping(
            map_type='Same As',
            from_concept=self.concept1,
            to_concept=self.concept2,
            external_id='mapping1',
        )
        source_version = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(0, len(source_version.mappings))
        kwargs = {
            'parent_resource': self.source1,
        }
        Mapping.persist_new(mapping, self.user1, **kwargs)
        mapping = Mapping.objects.get(external_id='mapping1')

        source_version = SourceVersion.objects.get(id=source_version.id)
        self.assertEquals(1, len(source_version.mappings))
        self.assertTrue(MappingVersion.objects.get(versioned_object_id=mapping.id).id in source_version.mappings)

        mapping.to_concept = self.concept3
        errors = Mapping.persist_changes(mapping, None)
        self.assertEquals(1, len(errors))
        self.assertTrue('updated_by' in errors)

        source_version = SourceVersion.objects.get(id=source_version.id)
        self.assertEquals(1, len(source_version.mappings))
        self.assertTrue(MappingVersion.objects.get(versioned_object_id=mapping.id).id in source_version.mappings)
开发者ID:AnshuAg,项目名称:oclapi,代码行数:29,代码来源:tests.py

示例12: test_persist_clone_positive

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_persist_clone_positive(self):
        self.assertEquals(2, self.concept1.num_versions)
        self.assertEquals(
            self.concept_version, ConceptVersion.get_latest_version_of(self.concept1))

        source_version = SourceVersion.get_latest_version_of(self.source1)

        source_version.update_concept_version(self.concept_version)
        self.assertEquals(1, len(source_version.concepts))
        self.assertEquals(self.concept_version.id, source_version.concepts[0])

        version2 = self.concept_version.clone()
        errors = ConceptVersion.persist_clone(version2, self.user1)
        self.assertEquals(0, len(errors))

        self.assertEquals(3, self.concept1.num_versions)
        self.assertEquals(version2, ConceptVersion.get_latest_version_of(self.concept1))
        self.assertEquals(self.concept_version.public_access, version2.public_access)
        self.assertEquals(self.concept_version, version2.previous_version)
        self.assertEquals(self.concept_version.root_version, version2.root_version)
        self.assertEquals(self.concept_version.external_id, version2.external_id)
        self.assertEquals(self.user1.username, version2.version_created_by)

        source_version.update_concept_version(version2)
        self.assertEquals(1, len(source_version.concepts))
        self.assertEquals(version2.id, source_version.concepts[0])
开发者ID:AnjaliWadhwa,项目名称:oclapi,代码行数:28,代码来源:tests.py

示例13: test_persist_new_positive

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_persist_new_positive(self):
        concept = Concept(
            mnemonic='concept1',
            created_by=self.user1,
            parent=self.source1,
            concept_class='First',
            names=[self.name],
        )
        source_version = SourceVersion.get_latest_version_of(self.source1)
        self.assertEquals(0, len(source_version.concepts))
        kwargs = {
            'parent_resource': self.source1,
        }
        errors = Concept.persist_new(concept, self.user1, **kwargs)
        self.assertEquals(0, len(errors))

        self.assertTrue(Concept.objects.filter(mnemonic='concept1').exists())
        self.assertFalse(concept.retired)
        self.assertEquals(self.name.name, concept.display_name)
        self.assertEquals(self.name.locale, concept.display_locale)
        self.assertEquals(self.source1.owner_name, concept.owner_name)
        self.assertEquals(self.source1.owner_type, concept.owner_type)
        self.assertEquals(self.source1.public_access, concept.public_access)
        self.assertEquals(1, concept.num_versions)
        concept_version = ConceptVersion.get_latest_version_of(concept)
        self.assertEquals(concept_version, concept_version.root_version)

        source_version = SourceVersion.objects.get(id=source_version.id)
        self.assertEquals(1, len(source_version.concepts))
        self.assertTrue(concept_version.id in source_version.concepts)
        self.assertEquals(concept_version.mnemonic, concept_version.id)
开发者ID:AnjaliWadhwa,项目名称:oclapi,代码行数:33,代码来源:tests.py

示例14: test_create_concept_reference_source_version__positive

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_create_concept_reference_source_version__positive(self):
        source_version = SourceVersion.get_latest_version_of(self.source1)
        concept_reference = ConceptReference(
            created_by=self.user1,
            updated_by=self.user1,
            parent=self.source1,
            mnemonic='reference1',
            concept=self.concept1,
            source_version=source_version,
        )
        concept_reference.full_clean()
        concept_reference.save()

        self.assertTrue(ConceptReference.objects.filter(mnemonic='reference1').exists())
        self.assertEquals(self.concept1.concept_class, concept_reference.concept_class)
        self.assertEquals(self.concept1.datatype, concept_reference.data_type)
        self.assertEquals(self.concept1.parent, concept_reference.source)
        self.assertEquals(self.concept1.owner_name, concept_reference.owner_name)
        self.assertEquals(self.concept1.owner_type, concept_reference.owner_type)
        self.assertEquals(self.concept1.display_name, concept_reference.display_name)
        self.assertEquals(self.concept1.display_locale, concept_reference.display_locale)
        self.assertEquals(
            '/users/user1/sources/source1/%s/concepts/concept1/' % source_version.mnemonic,
            concept_reference.concept_reference_url)
        self.assertFalse(concept_reference.is_current_version)
开发者ID:AnjaliWadhwa,项目名称:oclapi,代码行数:27,代码来源:tests.py

示例15: test_import_job_for_change_in_data

# 需要导入模块: from sources.models import SourceVersion [as 别名]
# 或者: from sources.models.SourceVersion import get_latest_version_of [as 别名]
    def test_import_job_for_change_in_data(self):
        stdout_stub = TestStream()
        stderr_stub = TestStream()
        mapping = Mapping(
            parent=self.source1,
            map_type='SAME-AS',
            from_concept=self.concept3,
            to_source=self.source1,
            to_concept_code='413532003',
            external_id='junk'
        )
        kwargs = {
            'parent_resource': self.source1,
        }
        Mapping.persist_new(mapping, self.user1, **kwargs)
        source_version = SourceVersion.get_latest_version_of(self.source1)
        source_version.mappings = [mapping.id]
        source_version.save()

        importer = MappingsImporter(self.source1, self.testfile, stdout_stub, stderr_stub, 'test')
        importer.import_mappings(total=1)
        self.assertTrue('mappings of 1 1 - 1 updated' in stdout_stub.getvalue())
        self.assertTrue(('Updated mapping with ID ' + mapping.id) in stdout_stub.getvalue())
        updated_mapping = Mapping.objects.get(to_concept_code='413532003')
        self.assertTrue(updated_mapping.retired)
        self.assertEquals(updated_mapping.external_id, '70279ABBBBBBBBBBBBBBBBBBBBBBBBBBBBBB')
开发者ID:AnshuAg,项目名称:oclapi,代码行数:28,代码来源:bulk_import_validation.py


注:本文中的sources.models.SourceVersion.get_latest_version_of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。