test_mixins.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:xblock-video 作者: appsembler 项目源码 文件源码
def test_download_transcript_handler_response_object(self, get_mock, get_filename_mock):
        """
        Test transcripts downloading works properly.
        """
        # Arrange
        get_filename_mock.return_value = 'transcript.vtt'
        get_mock.return_value.text = 'vtt transcripts'
        request_mock = MagicMock()
        request_mock.host_url = 'test.host'
        request_mock.query_string = '/test-query-string'

        # Act
        vtt_response = self.xblock.download_transcript(request_mock, 'unused suffix')

        # Assert
        self.assertIsInstance(vtt_response, Response)
        self.assertEqual(vtt_response.text, 'vtt transcripts')
        self.assertEqual(vtt_response.headerlist, [
            ('Content-Type', 'text/plain'),
            ('Content-Disposition', 'attachment; filename={}'.format('transcript.vtt'))
        ])
        get_mock.assert_called_once_with('test.host/test-query-string')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号