def test_no_recordings_folder(self): fetch_server = Mock() fetch_server.url = URL_NO_RECORDINGS options = fetchtv.Options([CMD_RECORDINGS]) results = fetchtv.get_fetch_recordings(fetch_server, options) fetchtv.print_recordings(results) self.assertEqual(0, len(results))
def test_get_shows(self): fetch_server = Mock() fetch_server.url = URL_DUMMY options = fetchtv.Options([CMD_SHOWS]) results = fetchtv.get_fetch_recordings(fetch_server, options) fetchtv.print_recordings(results) self.assertEqual(8, len(results))
def test_exclude_one_show(self): fetch_server = Mock() fetch_server.url = URL_DUMMY options = fetchtv.Options( [CMD_RECORDINGS, f'{OPTION_EXCLUDE}="{SHOW_ONE}"']) results = fetchtv.get_fetch_recordings(fetch_server, options) fetchtv.print_recordings(results) self.assertEqual(7, len(results))
def test_get_all_recordings(self): fetch_server = Mock() fetch_server.url = URL_DUMMY options = fetchtv.Options([CMD_RECORDINGS]) results = fetchtv.get_fetch_recordings(fetch_server, options) fetchtv.print_recordings(results) self.assertEqual(8, len(results)) self.assertEqual(134, len(results[4]['items']))
def test_get_two_show_recording(self): fetch_server = Mock() fetch_server.url = URL_DUMMY options = fetchtv.Options( [CMD_RECORDINGS, f'{OPTION_FOLDER}="{SHOW_ONE}, {SHOW_TWO}"']) results = fetchtv.get_fetch_recordings(fetch_server, options) fetchtv.print_recordings(results) self.assertEqual(3, len( results)) # Test data returns LEGO Masters and Lego Masters....
def test_get_one_show_recording(self): fetch_server = Mock() fetch_server.url = URL_DUMMY options = fetchtv.Options( [CMD_RECORDINGS, f'{OPTION_FOLDER}="{SHOW_ONE}"']) results = fetchtv.get_fetch_recordings(fetch_server, options) fetchtv.print_recordings(results) self.assertEqual(1, len(results)) self.assertEqual(134, len(results[0]['items']))
def test_exclude_two_shows(self): fetch_server = Mock() fetch_server.url = URL_DUMMY options = fetchtv.Options( [CMD_RECORDINGS, f'{OPTION_EXCLUDE}="{SHOW_ONE}, {SHOW_TWO}"']) results = fetchtv.get_fetch_recordings(fetch_server, options) fetchtv.print_recordings(results) self.assertEqual( 5, len(results) ) # Test data has LEGO Masters and Lego Masters - both are matched
def test_get_two_recording_item(self): fetch_server = Mock() fetch_server.url = URL_DUMMY options = fetchtv.Options([ CMD_RECORDINGS, f'{OPTION_FOLDER}="{SHOW_ONE}"', f'{OPTION_TITLE}="{SHOW_ONE_EP_ONE}, {SHOW_ONE_EP_TWO}"' ]) results = fetchtv.get_fetch_recordings(fetch_server, options) fetchtv.print_recordings(results) self.assertEqual(1, len(results)) self.assertEqual(2, len(results[0]['items']))
def test_get_shows_json(self): fetch_server = Mock() fetch_server.url = URL_DUMMY options = fetchtv.Options([CMD_SHOWS, OPTION_JSON]) results = fetchtv.get_fetch_recordings(fetch_server, options) output = fetchtv.print_recordings(results) output = json.loads(output) self.assertEqual(8, len(output))
def test_get_recordings_items_json(self): fetch_server = Mock() fetch_server.url = URL_DUMMY options = fetchtv.Options([CMD_IS_RECORDING, OPTION_JSON]) results = fetchtv.get_fetch_recordings(fetch_server, options) output = fetchtv.print_recordings(results) output = json.loads(output) self.assertEqual(1, len(output)) self.assertEqual(1, len(output[0]['items']))