Package: django-ranged-response / 0.2.0-5

0001-complete-the-test-suite.patch Patch series | download
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
From: Sunil Mohan Adapa <sunil@medhas.org>
Date: Wed, 14 Mar 2018 08:44:58 +0530
Subject: complete-the-test-suite

---
 test/__init__.py      | 10 ++++++++++
 test/test_response.py | 24 ++++++++++++------------
 2 files changed, 22 insertions(+), 12 deletions(-)
 create mode 100644 test/__init__.py

diff --git a/test/__init__.py b/test/__init__.py
new file mode 100644
index 0000000..6f9be7d
--- /dev/null
+++ b/test/__init__.py
@@ -0,0 +1,10 @@
+from django.conf import settings
+
+
+# Make sure django can initialize for testing.
+settings.configure(DATABASES={
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': 'test/db.sqlite3',
+    }
+})
diff --git a/test/test_response.py b/test/test_response.py
index a357639..624a8aa 100644
--- a/test/test_response.py
+++ b/test/test_response.py
@@ -15,55 +15,55 @@ class testResponse(TestCase):
         request = self.factory.get(
             '/path', HTTP_RANGE='bytes=0-3'
         )
-        回應 = RangedFileResponse(
+        response = RangedFileResponse(
             request, io.BytesIO(b'sui2khiau2tsiang5'), content_type='audio/wav'
         )
-        self.assertContent(回應, b'sui2')
+        self.assertContent(response, b'sui2')
 
     def test_middle(self):
         request = self.factory.get(
             '/path', HTTP_RANGE='bytes=4-9'
         )
-        回應 = RangedFileResponse(
+        response = RangedFileResponse(
             request, io.BytesIO(b'sui2khiau2tsiang5'), content_type='audio/wav'
         )
-        self.assertContent(回應, b'khiau2')
+        self.assertContent(response, b'khiau2')
 
     def test_end(self):
         request = self.factory.get(
             '/path', HTTP_RANGE='bytes=10-16'
         )
-        回應 = RangedFileResponse(
+        response = RangedFileResponse(
             request, io.BytesIO(b'sui2khiau2tsiang5'), content_type='audio/wav'
         )
-        self.assertContent(回應, b'tsiang5')
+        self.assertContent(response, b'tsiang5')
 
     def test_failing(self):
         request = self.factory.get(
             '/path', HTTP_RANGE='bytes=17-20'
         )
-        回應 = RangedFileResponse(
+        response = RangedFileResponse(
             request, io.BytesIO(b'sui2khiau2tsiang5'), content_type='audio/wav'
         )
-        self.assertEqual(回應.status_code, 416)
+        self.assertEqual(response.status_code, 416)
 
     def test_overlapping(self):
         request = self.factory.get(
             '/path', HTTP_RANGE='bytes=10-20'
         )
-        回應 = RangedFileResponse(
+        response = RangedFileResponse(
             request, io.BytesIO(b'sui2khiau2tsiang5'), content_type='audio/wav'
         )
-        self.assertContent(回應, b'tsiang5')
+        self.assertContent(response, b'tsiang5')
 
     def test_more_one_char(self):
         request = self.factory.get(
             '/path', HTTP_RANGE='bytes=10-17'
         )
-        回應 = RangedFileResponse(
+        response = RangedFileResponse(
             request, io.BytesIO(b'sui2khiau2tsiang5'), content_type='audio/wav'
         )
-        self.assertContent(回應, b'tsiang5')
+        self.assertContent(response, b'tsiang5')
 
     def assertContent(self, response, except_response):
         self.assertEqual(list(response.streaming_content)[0], except_response)