فهرست منبع

Writing tests for yelp

David Leonard 10 سال پیش
والد
کامیت
c89f592efd
1فایلهای تغییر یافته به همراه10 افزوده شده و 1 حذف شده
  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, '')