tests.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. from django.test import TestCase
  2. # Create your tests here.
  3. class HackathonViewsTestCase(TestCase):
  4. def testIndex(self):
  5. resp = self.client.get('/hackathon/api/')
  6. self.assertEqual(resp.status_code, 200)
  7. def testSteam(self):
  8. resp = self.client.get('/hackathon/steam/')
  9. self.assertEqual(resp.status_code, 200)
  10. def testSteamDiscountedGames(self):
  11. resp = self.client.get('/hackathon/steamDiscountedGames/')
  12. self.assertEqual(resp.status_code, 200)
  13. def testSteamPlaytimeForever(self):
  14. resp = self.client.get('/hackathon/steam/')
  15. for dict in resp.context:
  16. if 'playtime_forever' in dict:
  17. self.assertTrue('playtime_forever' in dict)
  18. def testSteamName(self):
  19. resp = self.client.get('/hackathon/steam/')
  20. for dict in resp.context:
  21. if 'name' in dict:
  22. self.assertTrue('name' in dict)
  23. def testSteamImg(self):
  24. resp = self.client.get('/hackathon/steam/')
  25. for dict in resp.context:
  26. if 'img_logo_url' in dict:
  27. self.assertTrue('img_logo_url' in dict)
  28. def testSteamAppID(self):
  29. resp = self.client.get('/hackathon/steam/')
  30. for dict in resp.context:
  31. if 'appid' in dict:
  32. self.assertTrue('appid' in dict)
  33. def testQuandlDowJones(self):
  34. resp = self.client.get('/hackathon/quandlDowJones/')
  35. self.assertEqual(resp.status_code, 200)
  36. def testQuandlSnp500(self):
  37. resp = self.client.get('/hackathon/quandlSnp500/')
  38. self.assertEqual(resp.status_code, 200)
  39. def testQuandlNasdaq(self):
  40. resp = self.client.get('/hackathon/quandlNasdaq/')
  41. self.assertEqual(resp.status_code, 200)
  42. def testGithubUser(self):
  43. resp = self.client.get('/hackathon/githubUser/')
  44. self.assertEqual(resp.status_code, 200)
  45. def testGithubTopRepositories(self):
  46. resp = self.client.get('/hackathon/githubTopRepositories/')
  47. self.assertEqual(resp.status_code, 200)
  48. def testGithubResume(self):
  49. resp = self.client.get('/hackathon/githubResume/')
  50. self.assertEqual(resp.status_code, 200)
  51. def testTwilio(self):
  52. resp = self.client.get('/hackathon/twilio/')
  53. self.assertEqual(resp.status_code, 200)