コード例 #1
0
 def test_add_keys(self):
     keys = LicenseKeys()
     self.assertFalse(keys.has_key("KEY1"))
     keys.add_key("KEY1", "VALUE1")
     self.assertTrue(keys.has_key("KEY1"))
     self.assertEqual("VALUE1", keys.get_key("KEY1"))
     keys.add_key("KEY1", "VALUE2")
     self.assertTrue(keys.has_key("KEY1"))
     self.assertEqual("VALUE2", keys.get_key("KEY1"))
コード例 #2
0
 def test_geonames_with_license_keys(self):
     license_keys = LicenseKeys()
     license_keys.add_key('GEO_NAMES_COUNTRY', "DummyValue")
     license_keys.add_key('GEO_NAMES_ACCOUNTNAME', "DummyValue")
     geonames = GeoNamesApi(license_keys)
コード例 #3
0
 def test_geonames_no_country(self):
     license_keys = LicenseKeys()
     license_keys.add_key('GEO_NAMES_ACCOUNTNAME', "DummyValue")
     with self.assertRaises(Exception):
         geonames = GeoNamesApi(license_keys)