def test_cmdline_show_save(self):
     fetchtv.download_file = Mock()  #Don't save any files
     fetchtv.main([
         '--ip=' + TestUpnp.FETCHTV_IP,
         '--port=' + str(TestUpnp.FETCHTV_PORT), '--folder="2 Broke Girls"',
         '--recordings', '--save=c:\\temp'
     ])
 def test_download_shows_episodes(self):
     self.calls = 0
     with patch('fetchtv_upnp.download_file', Mock()):
         fetchtv.main([VAL_IP, VAL_PORT,
                       f'{OPTION_FOLDER}="{SHOW_ONE}, {SHOW_TWO}"',
                       f'{OPTION_TITLE}="{SHOW_ONE_EP_ONE}, {SHOW_ONE_EP_TWO}"', CMD_RECORDINGS, OPTION_OVERWRITE, f'{OPTION_SAVE}="{SAVE_FOLDER}"'])
         self.assertEqual(2, fetchtv.download_file.call_count)
 def test_cmdline_recording_info(self):
     fetchtv.main([
         '--ip=' + TestUpnp.FETCHTV_IP,
         '--port=' + str(TestUpnp.FETCHTV_PORT), '--recordings'
     ])
     fetchtv.main([
         '--ip=' + TestUpnp.FETCHTV_IP,
         '--port=' + str(TestUpnp.FETCHTV_PORT), '--recordings',
         '--folder="2 Broke Girls"'
     ])
 def test_cmdline_info(self):
     fetchtv.main([
         '--ip=' + TestUpnp.FETCHTV_IP,
         '--port=' + str(TestUpnp.FETCHTV_PORT), '--info'
     ])
     fetchtv.main(['--ip=' + TestUpnp.FETCHTV_IP, '--info'])
 def test_cmdline_help(self):
     fetchtv.main(['--help'])
 def test_cmdline_auto_discovery(self):
     fetchtv.main([])
 def test_cmdline_anything_recording(self):
     fetchtv.main([VAL_IP, VAL_PORT, CMD_IS_RECORDING, OPTION_JSON])
 def test_cmdline_recording_info_json(self):
     fetchtv.main([VAL_IP, VAL_PORT, CMD_RECORDINGS, OPTION_JSON])
 def test_cmdline_recording_info(self):
     fetchtv.main([VAL_IP, VAL_PORT, CMD_RECORDINGS])
 def test_cmdline_info(self):
     fetchtv.main([VAL_IP, VAL_PORT, CMD_INFO])
     fetchtv.main([VAL_IP, CMD_INFO])
 def test_cmdline_show_save_all_json(self):
     with patch('fetchtv_upnp.download_file', Mock()):
         fetchtv.main([VAL_IP, VAL_PORT, f'{OPTION_FOLDER}="{SHOW_TWO}"',
                       CMD_RECORDINGS, OPTION_JSON, OPTION_OVERWRITE, f'{OPTION_SAVE}={SAVE_FOLDER}'])
 def test_cmdline_save(self):
     with patch('fetchtv_upnp.download_file', Mock()):
         fetchtv.main(
             [VAL_IP, VAL_PORT, CMD_RECORDINGS, f'{OPTION_SAVE}={SAVE_FOLDER}'])
 def test_cmdline_recording_episode(self):
     fetchtv.main([VAL_IP, VAL_PORT, CMD_RECORDINGS,
                   f'{OPTION_FOLDER}="{SHOW_ONE}"', f'{OPTION_TITLE}="{SHOW_ONE_EP_ONE}"'])
 def test_cmdline_recording_info_exclude(self):
     fetchtv.main([VAL_IP, VAL_PORT, CMD_RECORDINGS,
                   f'{OPTION_EXCLUDE}="{SHOW_ONE}"'])
 def test_cmdline_recording_info_show(self):
     fetchtv.main([VAL_IP, VAL_PORT, CMD_RECORDINGS,
                   f'{OPTION_FOLDER}="{SHOW_ONE}"'])
 def test_cmdline_shows_info(self):
     fetchtv.main([VAL_IP, VAL_PORT, CMD_SHOWS])