self.config["plex"]["token"], "My Music Library", ), "2", ) @responses.activate def test_update_plex(self): # Adding responses. self.add_response_get_music_section() self.add_response_update_plex() # Testing status code of the mocking request. self.assertEqual( update_plex( self.config["plex"]["host"], self.config["plex"]["port"], self.config["plex"]["token"], self.config["plex"]["library_name"].get(), ).status_code, 200, ) def suite(): return unittest.TestLoader().loadTestsFromName(__name__) if __name__ == b"__main__": unittest.main(defaultTest="suite")
results_asc = list(self.lib.items(u'foo+ id+')) self.assertEqual([i.id for i in results_asc], # items without field first [ids[0], ids[3], ids[1], ids[2]]) results_desc = list(self.lib.items(u'foo- id+')) self.assertEqual([i.id for i in results_desc], # items without field last [ids[2], ids[1], ids[0], ids[3]]) def test_negation_interaction(self): """Test the handling of negation and sorting together. If a string ends with a sorting suffix, it takes precedence over the NotQuery parsing. """ query, sort = beets.library.parse_query_string(u'-bar+', beets.library.Item) self.assertEqual(len(query.subqueries), 1) self.assertTrue(isinstance(query.subqueries[0], dbcore.query.TrueQuery)) self.assertTrue(isinstance(sort, dbcore.query.SlowFieldSort)) self.assertEqual(sort.field, u'-bar') def suite(): return unittest.TestLoader().loadTestsFromName(__name__) if __name__ == b'__main__': unittest.main(defaultTest='suite')
urlTitle = u'example.com | Beats song by John doe' # very small diffs (typo) are ok eg 'beats' vs 'beets' with same artist self.assertEqual( google.is_page_candidate(url, urlTitle, s['title'], s['artist']), True, url) # reject different title urlTitle = u'example.com | seets bong lyrics by John doe' self.assertEqual( google.is_page_candidate(url, urlTitle, s['title'], s['artist']), False, url) def test_is_page_candidate_special_chars(self): """Ensure that `is_page_candidate` doesn't crash when the artist and such contain special regular expression characters. """ # https://github.com/sampsyo/beets/issues/1673 s = self.source url = s['url'] + s['path'] url_title = u'foo' google.is_page_candidate(url, url_title, s['title'], 'Sunn O)))') def suite(): return unittest.TestLoader().loadTestsFromName(__name__) if __name__ == b'__main__': unittest.main(defaultTest='suite')