def test_type(self): grct = self.patch(utils, "get_response_content_type") grct.return_value = self.content_type self.assertEqual( self.is_textual, utils.is_response_textual(sentinel.response) ) self.assertThat(grct, MockCalledOnceWith(sentinel.response))
def test_type(self, mocker, content_type, is_textual): grct = mocker.patch.object( utils, "get_response_content_type", return_value=content_type ) assert utils.is_response_textual(sentinel.response) == is_textual grct.assert_called_once_with(sentinel.response)