Example #1
0
    def test_parses_plain(self):
        self.response.content = sentinel.content
        self.response.headers = {
            'content-type': 'text/plain',
        }

        content = get_response_content(self.response)
        eq_(content, sentinel.content)
Example #2
0
    def test_parses_json(self):
        self.response.json.return_value = sentinel.json
        self.response.headers = {
            'content-type': 'application/json',
        }

        content = get_response_content(self.response)

        self.response.json.assert_called_once_with()
        eq_(content, sentinel.json)
Example #3
0
    def test_parses_html(self, mock_soup):
        self.response.content = sentinel.content
        self.response.headers = {
            'content-type': 'text/html',
        }
        mock_soup.return_value = sentinel.soup

        content = get_response_content(self.response)

        mock_soup.assert_called_once_with(sentinel.content)
        eq_(content, sentinel.soup)