|
4 | 4 | from django.test import TestCase |
5 | 5 | from django.test.client import Client |
6 | 6 |
|
7 | | -from smoke import TestFailedSmokeTests |
| 7 | +from .smoke import TestFailedSmokeTests |
8 | 8 | from smoketest import SmokeTest |
9 | 9 |
|
10 | 10 |
|
@@ -34,28 +34,31 @@ def test_basics(self): |
34 | 34 | response = self.c.get("/smoketest/") |
35 | 35 | self.assertEqual(response.status_code, 500) |
36 | 36 |
|
37 | | - self.assertIn("FAIL", response.content) |
| 37 | + self.assertIn("FAIL", response.content.decode('utf-8')) |
38 | 38 | # only tests from TestFailedSmokeTests should fail |
39 | | - self.assertNotIn(".SmokeTest.", response.content) |
| 39 | + self.assertNotIn(".SmokeTest.", |
| 40 | + response.content.decode('utf-8')) |
40 | 41 | # and both tests from TestFailedSmokeTests should fail |
41 | | - self.assertIn("tests failed: 2\n", response.content) |
42 | | - self.assertIn("tests errored: 0\n", response.content) |
| 42 | + self.assertIn("tests failed: 2\n", |
| 43 | + response.content.decode('utf-8')) |
| 44 | + self.assertIn("tests errored: 0\n", |
| 45 | + response.content.decode('utf-8')) |
43 | 46 | self.assertIn( |
44 | 47 | (".TestFailedSmokeTests.test_assertTrueWoMsg " |
45 | 48 | "failed: False is not true"), |
46 | | - response.content) |
| 49 | + response.content.decode('utf-8')) |
47 | 50 | self.assertIn( |
48 | 51 | ".TestFailedSmokeTests.test_assertEqualWMsg failed: %s" % |
49 | 52 | TestFailedSmokeTests.CUSTOM_TEST_MSG, |
50 | | - response.content) |
| 53 | + response.content.decode('utf-8')) |
51 | 54 |
|
52 | 55 | def test_json(self): |
53 | 56 | " Testing JSON response. " |
54 | 57 | json_content_type = 'application/json' |
55 | 58 | response = self.c.get("/smoketest/", HTTP_ACCEPT=json_content_type) |
56 | 59 | self.assertEqual(json_content_type, response.get('Content-Type', None)) |
57 | 60 |
|
58 | | - response_obj = json.loads(response.content) |
| 61 | + response_obj = json.loads(response.content.decode('utf-8')) |
59 | 62 | self.assertEqual('FAIL', response_obj['status']) |
60 | 63 | self.assertEqual(2, response_obj['tests_failed']) |
61 | 64 | self.assertEqual(0, response_obj['tests_errored']) |
|
0 commit comments