def test_schema(self, mock_details, mock_cat, mock_term, mock_search, mock_auth, execute_task): mock_details.return_value = MockRestClient.details_result mock_cat.return_value = MockRestClient.cat_result mock_term.return_value = MockRestClient.term_result mock_search.return_value = MockRestClient.search_result mock_auth.return_value = None task = execute_task('uncached_db') log.debug(task.all_entries) assert len(task.all_entries) == 1 entry = task.all_entries[0] quality = entry.get('quality') assert quality is not None log.debug(quality) quality_tester = Requirements('1080p hdtv 10bit dd5.1') assert quality_tester.allows(quality)
def radarr_quality_to_flexget_quality_req(radarr_quality): """ Translates the provided Radarr quality string to a Flexget Requirement instance. Returns None if translation is unsuccessful """ # QUALITIES_MAP has its keys in lower case radarr_quality = radarr_quality.lower() if not radarr_quality in QUALITIES_MAP: log.warning("Did not find a suitible translation for Radarr quality '%s'", radarr_quality) return None flexget_quality_req_string = QUALITIES_MAP[radarr_quality] try: return Requirements(flexget_quality_req_string) except ValueError: log.error( "Failed to convert %s into a valid quality requirement", flexget_quality_req_string )