2016-01-10 16:12:58 +00:00
|
|
|
from django.test import TestCase
|
|
|
|
from django.core.urlresolvers import reverse
|
|
|
|
|
|
|
|
|
2016-01-27 18:13:41 +00:00
|
|
|
class AboutTestCase(TestCase):
|
|
|
|
def test_website_accessable(self):
|
2016-01-26 22:41:43 +00:00
|
|
|
response = self.client.get(reverse('about:website'))
|
2016-01-10 16:12:58 +00:00
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
2016-01-27 18:13:41 +00:00
|
|
|
def test_me_accessable(self):
|
|
|
|
response = self.client.get(reverse('about:me'))
|
|
|
|
self.assertEqual(response.status_code, 200)
|
2016-01-10 16:12:58 +00:00
|
|
|
|
2016-01-27 18:13:41 +00:00
|
|
|
def test_index_accessable(self):
|
2016-01-26 22:41:43 +00:00
|
|
|
response = self.client.get(reverse('about:index'))
|
2016-01-10 16:12:58 +00:00
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
2016-01-24 19:54:57 +00:00
|
|
|
def test_email_send(self):
|
|
|
|
data = {
|
|
|
|
'email': '123@123.123',
|
|
|
|
'name': 'Person',
|
|
|
|
'message': 'Hi there, things.'
|
|
|
|
}
|
2016-01-26 22:41:43 +00:00
|
|
|
response = self.client.post(reverse('about:index'), data)
|
2016-01-24 19:54:57 +00:00
|
|
|
self.assertRedirects(response, '/about/?sent')
|
|
|
|
|
2016-01-24 20:34:19 +00:00
|
|
|
def test_success_message_shows(self):
|
2016-01-26 22:41:43 +00:00
|
|
|
response = self.client.get(reverse('about:index') + '?sent')
|
2016-01-24 20:34:19 +00:00
|
|
|
self.assertContains(response, 'Already Sent')
|
|
|
|
|
2016-01-10 16:12:58 +00:00
|
|
|
|
2016-01-27 18:13:41 +00:00
|
|
|
class CorePagesTestCase(TestCase):
|
|
|
|
def test_404_accessable(self):
|
2016-01-10 16:12:58 +00:00
|
|
|
response = self.client.get(reverse('404'))
|
|
|
|
self.assertEqual(response.status_code, 404)
|
|
|
|
|
2016-01-27 18:13:41 +00:00
|
|
|
def test_no_js_accessable(self):
|
2016-01-10 16:12:58 +00:00
|
|
|
response = self.client.get(reverse('no-js'))
|
|
|
|
self.assertEqual(response.status_code, 200)
|
2016-01-21 07:51:44 +00:00
|
|
|
|
2016-01-27 18:13:41 +00:00
|
|
|
def test_index_accessable(self):
|
|
|
|
response = self.client.get(reverse('pages:index'))
|
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
2016-01-21 07:51:44 +00:00
|
|
|
|
2016-01-27 18:13:41 +00:00
|
|
|
class ProjectsTestCase(TestCase):
|
|
|
|
def test_all_accessable(self):
|
2016-01-26 22:41:43 +00:00
|
|
|
response = self.client.get(reverse('projects:all'))
|
2016-01-21 07:51:44 +00:00
|
|
|
self.assertEqual(response.status_code, 200)
|
2016-01-26 19:10:34 +00:00
|
|
|
|
2016-01-27 18:13:41 +00:00
|
|
|
def test_test_project_accessable(self):
|
|
|
|
response = self.client.get(reverse('projects:project', args=['test']))
|
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
2016-01-26 19:10:34 +00:00
|
|
|
|
|
|
|
class RoboticsTestCase(TestCase):
|
|
|
|
def test_2015_index_accessable(self):
|
2016-01-26 22:41:43 +00:00
|
|
|
response = self.client.get(reverse('robotics:2015-index'))
|
2016-01-26 19:10:34 +00:00
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
|
|
|
def test_2014_index_accessable(self):
|
2016-01-26 22:41:43 +00:00
|
|
|
response = self.client.get(reverse('robotics:2014-index'))
|
2016-01-26 19:10:34 +00:00
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
|
|
|
|
def test_2015_robot_accessable(self):
|
2016-01-26 22:41:43 +00:00
|
|
|
response = self.client.get(reverse('robotics:2015-robot'))
|
2016-01-26 19:10:34 +00:00
|
|
|
self.assertEqual(response.status_code, 200)
|
2016-01-29 22:14:35 +00:00
|
|
|
|
|
|
|
def test_2015_code_accessable(self):
|
|
|
|
response = self.client.get(reverse('robotics:2015-code'))
|
|
|
|
self.assertEqual(response.status_code, 200)
|
2016-01-31 19:08:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
class CollegeTestCase(TestCase):
|
|
|
|
def test_attack_on_blocks_accessable(self):
|
|
|
|
response = self.client.get(reverse('college:attack-on-blocks'))
|
|
|
|
self.assertEqual(response.status_code, 200)
|
2016-01-31 19:14:57 +00:00
|
|
|
|
|
|
|
def test_student_server_accessable(self):
|
|
|
|
response = self.client.get(reverse('college:student-server'))
|
|
|
|
self.assertEqual(response.status_code, 200)
|