File: tests.py

package info (click to toggle)
drf-extensions 0.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,308 kB
  • sloc: python: 7,421; makefile: 11
file content (15 lines) | stat: -rw-r--r-- 586 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from django.test import TestCase, override_settings
from django.utils.encoding import force_str


@override_settings(ROOT_URLCONF='tests_app.tests.functional.cache.decorators.urls')
class TestCacheResponseFunctionally(TestCase):

    def test_should_return_response(self):
        resp = self.client.get('/hello/')
        self.assertEqual(force_str(resp.content), '"Hello world"')

    def test_should_return_same_response_if_cached(self):
        resp_1 = self.client.get('/hello/')
        resp_2 = self.client.get('/hello/')
        self.assertEqual(resp_1.content, resp_2.content)