Esempio n. 1
0
class TestDownloadInteractiveHandler(unittest.TestCase):
    def setUp(self):
        self.handler = DownloadInteractiveHandler(None)
        self.handler._download = Mock()

    def test_only_one_sub(self):
        sub = {'lang': 'fr', 'source': 'test'}
        self.handler._handle([sub], ['fr', 'en'])
        self.handler._download.assert_called_with(sub)

    @patch(MOCK_INPUT)
    def test_with_choice(self, input_):
        input_.return_value = '2'
        subs = [
            {
                'lang': 'fr',
                'source': 'test'
            },
            {
                'lang': 'en',
                'source': 'test1'
            },
        ]
        self.handler._handle(subs, ['fr', 'en'])
        self.handler._download.assert_called_with({
            'lang': 'en',
            'source': 'test1'
        })
Esempio n. 2
0
class TestDownloadInteractiveHandler(unittest.TestCase):
    def setUp(self):
        self.handler = DownloadInteractiveHandler(None)
        self.handler._download = Mock()

    def test_only_one_sub(self):
        sub = {'lang': 'fr', 'source': 'test'}
        self.handler._handle([sub], ['fr', 'en'])
        self.handler._download.assert_called_with(sub)

    @patch(MOCK_INPUT)
    def test_with_choice(self, input_):
        input_.return_value = '2'
        subs = [
            {'lang': 'fr', 'source': 'test'},
            {'lang': 'en', 'source': 'test1'},
        ]
        self.handler._handle(subs, ['fr', 'en'])
        self.handler._download.assert_called_with({'lang': 'en',
                                                   'source': 'test1'})
Esempio n. 3
0
 def setUp(self):
     self.handler = DownloadInteractiveHandler(None)
     self.handler._download = Mock()
Esempio n. 4
0
 def setUp(self):
     self.handler = DownloadInteractiveHandler(None)
     self.handler._download = Mock()