def test_mailing_list_url(self): """Test whether it returns the URL of a mailing list in Gmane""" setup_http_server() client = GmaneClient() url = client.mailing_list_url('*****@*****.**') self.assertEqual(url, GMANE_MYLIST_URL)
def test_mailing_list_url_not_found(self): """Test whether it raises an exception when a mailing list is not found""" httpretty.register_uri(httpretty.GET, GMANE_INVALID_LIST_URL, status=200, body="No such list") client = GmaneClient() with self.assertRaises(RepositoryError): client.mailing_list_url('*****@*****.**')
def test_messages(self): """Test if a set of messages is fetched""" body = read_file('data/gmane_messages.mbox', 'rb') url = GMAME_DOWNLOAD_LIST_URL + '/888/898' httpretty.register_uri(httpretty.GET, url, status=200, body=body) client = GmaneClient() response = client.messages('gmane.comp.example.mylist', 888, 10) self.assertEqual(response, body)