예제 #1
0
    def test_namespace_unique(self):
        """
        the namespace column must be unique
        """
        ca = ConceptAuthority(host='http://chps.asu.edu/conceptpower/rest',
                              name='ASU Conceptpower',
                              queryformat='/ConceptLookup/{0}/{1}',
                              retrieveformat='/Concept?id={0}',
                              namespace='http://www.digitalhps.org')
        ca.save()
        ca2 = ConceptAuthority(host='http://chps.asu.edu/conceptpower/rest',
                               name='ASU Conceptpower',
                               queryformat='/ConceptLookup/{0}/{1}',
                               retrieveformat='/Concept?id={0}',
                               namespace='http://www.digitalhps.org')

        self.assertRaises(IntegrityError, ca2.save)
예제 #2
0
def create_concept_authority():
    concept_authority = ConceptAuthority(
        host='http://chps.asu.edu/conceptpower/rest',
        name='ASU Conceptpower',
        queryformat='/ConceptLookup/{0}/{1}',
        retrieveformat='/Concept?id={0}',
        namespace='http://www.digitalhps.org')

    concept_authority.save()
    return concept_authority