def test_srt_to_vtt(self, convert_caps_to_vtt_mock, requests_mock):
"""
Test xBlock's srt-to-vtt convertation works properly.
"""
# Arrange
request_mock = MagicMock()
convert_caps_to_vtt_mock.return_value = 'vtt transcripts'
requests_mock.get.return_value.text = text_mock = PropertyMock()
text_mock.return_value = 'vtt transcripts'
# Act
vtt_response = self.xblock.srt_to_vtt(request_mock, 'unused suffix')
# Assert
self.assertIsInstance(vtt_response, Response)
self.assertEqual(vtt_response.text, 'vtt transcripts')
convert_caps_to_vtt_mock.assert_called_once_with(text_mock)
评论列表
文章目录