D
D
David Winter2020-12-16 09:40:42
Django
David Winter, 2020-12-16 09:40:42

Error in test AttributeError: `bytes` has no attribute `status_code`?

The code:

def test_no_question(self):
        response = self.client.get(reverse('index'))
        self.assertEqual(response.status_code.decode, 200)
        self.assertContains(response.content, "No tes are avialiable")
        self.assertQuerysetEqual(response.context_data['question_list'], [])

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mkone112, 2020-12-16
@mkone112

Well, apparently in the response - bytes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question