コード例 #1
0
def create_location_authority():
    location_authority = LocationAuthority(
        name='Geonames',
        namespace='http://www.geonames.org',
        host='http://api.geonames.org',
        retrieveformat='/get?geonameId={0}&username=erickpeirson&style=full',
        id_pattern='http://www.geonames.org/(.*?)/')
    location_authority.save()
    return location_authority
コード例 #2
0
ファイル: tests.py プロジェクト: rsubra13/Genecology.org
def create_location_authority():
    location_authority = LocationAuthority(
        name='Geonames',
        namespace='http://www.geonames.org',
        host='http://api.geonames.org',
        retrieveformat='/get?geonameId={0}&username=erickpeirson&style=full',
        id_pattern='http://www.geonames.org/(.*?)/' )
    location_authority.save()
    return location_authority
コード例 #3
0
 def test_namespace_unique(self):
     """
     the namespace column must be unique
     """
     la = LocationAuthority(name='testAuthority',
                            host='testHost',
                            namespace='testNamespace',
                            retrieveformat='testFormat',
                            id_pattern='testPattern')
     la.save()
     la2 = LocationAuthority(name='testAuthority',
                             host='testHost',
                             namespace='testNamespace',
                             retrieveformat='testFormat',
                             id_pattern='testPattern')
     self.assertRaises(IntegrityError, la2.save)
コード例 #4
0
ファイル: tests.py プロジェクト: rsubra13/Genecology.org
 def test_namespace_unique(self):
     """
     the namespace column must be unique
     """
     la = LocationAuthority( name='testAuthority',
                             host='testHost',
                             namespace='testNamespace',
                             retrieveformat='testFormat',
                             id_pattern='testPattern')
     la.save()
     la2 = LocationAuthority( name='testAuthority',
                             host='testHost',
                             namespace='testNamespace',
                             retrieveformat='testFormat',
                             id_pattern='testPattern')
     self.assertRaises(IntegrityError, la2.save)