-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathtests.py
More file actions
39 lines (30 loc) · 990 Bytes
/
Copy pathtests.py
File metadata and controls
39 lines (30 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from django.test import TestCase
from django.test.client import Client
from django.test.utils import override_settings
PING_CHECKS_FULL = (
'ping.checks.check_database_sessions',
'ping.checks.check_database_sites',
'ping.checks.check_cache_set',
'ping.checks.check_cache_set',
'ping.checks.check_user_exists',
)
PING_CHECKS_BAD = (
'pong.checks.check_database_sessions',
)
PING_CHECKS_BAD2 = (
'ping.checks.check_foo',
)
class PingTest(TestCase):
urls = 'ping.urls'
def setUp(self):
self.client = Client()
def test_endpoint(self):
response = self.client.get("")
self.assertEqual(response.status_code, 200)
@override_settings(PING_CHECKS=PING_CHECKS_FULL)
def test_checks(self):
response = self.client.get("?checks=true")
self.assertEqual(response.status_code, 200)
def test_json(self):
response = self.client.get("?fmt=json")
self.assertEqual(response.status_code, 200)