Esempio n. 1
0
	def test_byContinent(self):
		continents = get_continents()
		for continent in map(lambda continent: continent['code'], continents):
			countries = Countries.byContinent(continent)
			self.assertIsInstance(countries, list)
			for country in countries:
				self.assertEqual(continent, country['continent'])
Esempio n. 2
0
	def test_GetWithNoParams(self):
		r = self.testApp.get('/countries/')
		self.assertEqual(r.status, 200)
		countries = json.loads(r.body)
		self.assertListEqual(countries, Countries.find(lambda c: True))
Esempio n. 3
0
	def test_Countries(self):
		countries = Countries.find(lambda c: True)
		with_code = [country for country in countries if country['code']]
		self.assertTrue(len(with_code)/float(len(countries)) > 0.67)