Explorar o código

Adding tests for New York Times endpoints

David Leonard %!s(int64=10) %!d(string=hai) anos
pai
achega
047ef8f7ef
Modificáronse 1 ficheiros con 16 adicións e 0 borrados
  1. 16 0
      hackathon_starter/hackathon/tests.py

+ 16 - 0
hackathon_starter/hackathon/tests.py

@@ -107,5 +107,21 @@ class TwilioTestCase(TestCase):
 	#	resp = self.client.post('/hackathon/twilio/', {'number': '+13473282978', 'message': 'hello world'})
 	#	self.assertEqual(resp.status_code, 302)
 
+class NewYorkTimesTestCase(TestCase):
+	def testPopularArticles(self):
+		resp = self.client.get('/hackathon/nytimespop/')
+		self.assertEqual(resp.status_code, 200)
+
+	def testPopularArticlesContent(self):
+		resp = self.client.get('/hackathon/nytimespop/')
+		self.assertNotEqual(resp.content, '')
+
+	def testTopArticles(self):
+		resp = self.client.get('/hackathon/nytimestop/')
+		self.assertEqual(resp.status_code, 200)
+
+	def testTopArticlesContent(self):
+		resp = self.client.get('/hackathon/nytimestop/')
+		self.assertNotEqual(resp.content, '')