Selaa lähdekoodia

Writing tests for yelp

David Leonard 10 vuotta sitten
vanhempi
commit
c89f592efd
1 muutettua tiedostoa jossa 10 lisäystä ja 1 poistoa
  1. 10 1
      hackathon_starter/hackathon/tests.py

+ 10 - 1
hackathon_starter/hackathon/tests.py

@@ -1,4 +1,5 @@
 from django.test import TestCase
+from django.test import Client
 
 class SteamViewTestCase(TestCase):
 	def testSteam(self):
@@ -73,4 +74,12 @@ class HackathonViewsTestCase(TestCase):
 	
 	def testNytimespop(self):
 		resp = self.client.get('/hackathon/nytimespop/')
-		self.assertEqual(resp.status_code, 200)
+		self.assertEqual(resp.status_code, 200)
+
+	def testYelpPost(self):
+		resp = self.client.post('/hackathon/yelp/', {'location': 'yelp-san-francisco'})
+		self.assertEqual(resp.status_code, 200)
+
+	def testYelpContent(self):
+		resp = self.client.post('/hackathon/yelp/', {'location': 'yelp-san-francisco'})
+		self.assertNotEqual(resp.content, '')