From 83883fed6fc93c6fbd73d8350e5251b633f9f028 Mon Sep 17 00:00:00 2001
From: Gwyn Ciesla <gwync@protonmail.com>
Date: Tue, 5 Sep 2023 10:53:04 -0500
Subject: [PATCH 1/3] Python 3.12 unittest fixes.
---
mygpoclient/api_test.py | 206 ++++++++++++++++++------------------
mygpoclient/http_test.py | 12 +--
mygpoclient/json_test.py | 6 +-
mygpoclient/locator_test.py | 10 +-
mygpoclient/public_test.py | 24 ++---
mygpoclient/simple_test.py | 12 +--
6 files changed, 135 insertions(+), 135 deletions(-)
diff --git a/mygpoclient/api_test.py b/mygpoclient/api_test.py
index 738c719..3ff2847 100644
--- a/mygpoclient/api_test.py
+++ b/mygpoclient/api_test.py
@@ -48,9 +48,9 @@ class Test_SubscriptionChanges(unittest.TestCase):
def test_initSetsCorrectAttributes(self):
changes = api.SubscriptionChanges(self.ADD, self.REMOVE, self.SINCE)
- self.assertEquals(changes.add, self.ADD)
- self.assertEquals(changes.remove, self.REMOVE)
- self.assertEquals(changes.since, self.SINCE)
+ self.assertEqual(changes.add, self.ADD)
+ self.assertEqual(changes.remove, self.REMOVE)
+ self.assertEqual(changes.since, self.SINCE)
class Test_EpisodeActionChanges(unittest.TestCase):
@@ -63,8 +63,8 @@ class Test_EpisodeActionChanges(unittest.TestCase):
def test_initSetsCorrectAttributes(self):
changes = api.EpisodeActionChanges(self.ACTIONS, self.SINCE)
- self.assertEquals(changes.actions, self.ACTIONS)
- self.assertEquals(changes.since, self.SINCE)
+ self.assertEqual(changes.actions, self.ACTIONS)
+ self.assertEqual(changes.since, self.SINCE)
class Test_PodcastDevice(unittest.TestCase):
@@ -72,10 +72,10 @@ class Test_PodcastDevice(unittest.TestCase):
def test_initSetsCorrectAttributes(self):
device = api.PodcastDevice(DEVICE_ID_1, self.CAPTION, 'mobile', 42)
- self.assertEquals(device.device_id, DEVICE_ID_1)
- self.assertEquals(device.caption, self.CAPTION)
- self.assertEquals(device.type, 'mobile')
- self.assertEquals(device.subscriptions, 42)
+ self.assertEqual(device.device_id, DEVICE_ID_1)
+ self.assertEqual(device.caption, self.CAPTION)
+ self.assertEqual(device.type, 'mobile')
+ self.assertEqual(device.subscriptions, 42)
def test_invalidDeviceType_raisesValueError(self):
self.assertRaises(ValueError,
@@ -98,14 +98,14 @@ def test_initSetsCorrectAttributes(self):
action = api.EpisodeAction(FEED_URL_1, EPISODE_URL_1, 'play',
DEVICE_ID_1, self.XML_TIMESTAMP, self.VALID_STARTED,
self.VALID_POSITION, self.VALID_TOTAL)
- self.assertEquals(action.podcast, FEED_URL_1)
- self.assertEquals(action.episode, EPISODE_URL_1)
- self.assertEquals(action.action, 'play')
- self.assertEquals(action.device, DEVICE_ID_1)
- self.assertEquals(action.timestamp, self.XML_TIMESTAMP)
- self.assertEquals(action.started, self.VALID_STARTED)
- self.assertEquals(action.position, self.VALID_POSITION)
- self.assertEquals(action.total, self.VALID_TOTAL)
+ self.assertEqual(action.podcast, FEED_URL_1)
+ self.assertEqual(action.episode, EPISODE_URL_1)
+ self.assertEqual(action.action, 'play')
+ self.assertEqual(action.device, DEVICE_ID_1)
+ self.assertEqual(action.timestamp, self.XML_TIMESTAMP)
+ self.assertEqual(action.started, self.VALID_STARTED)
+ self.assertEqual(action.position, self.VALID_POSITION)
+ self.assertEqual(action.total, self.VALID_TOTAL)
def test_invalidAction_raisesValueError(self):
self.assertRaises(ValueError,
@@ -155,36 +155,36 @@ def test_invalidTotalFormat_raisesValueError(self):
def test_toDictionary_containsMandatoryAttributes(self):
action = api.EpisodeAction(FEED_URL_1, EPISODE_URL_1, 'play')
dictionary = action.to_dictionary()
- self.assertEquals(len(list(dictionary.keys())), 3)
- self.assert_('podcast' in dictionary)
- self.assert_('episode' in dictionary)
- self.assert_('action' in dictionary)
- self.assertEquals(dictionary['podcast'], FEED_URL_1)
- self.assertEquals(dictionary['episode'], EPISODE_URL_1)
- self.assertEquals(dictionary['action'], 'play')
+ self.assertEqual(len(list(dictionary.keys())), 3)
+ self.assertTrue('podcast' in dictionary)
+ self.assertTrue('episode' in dictionary)
+ self.assertTrue('action' in dictionary)
+ self.assertEqual(dictionary['podcast'], FEED_URL_1)
+ self.assertEqual(dictionary['episode'], EPISODE_URL_1)
+ self.assertEqual(dictionary['action'], 'play')
def test_toDictionary_containsAllAttributes(self):
action = api.EpisodeAction(FEED_URL_3, EPISODE_URL_4, 'play',
DEVICE_ID_1, self.XML_TIMESTAMP, self.VALID_STARTED,
self.VALID_POSITION, self.VALID_TOTAL)
dictionary = action.to_dictionary()
- self.assertEquals(len(list(dictionary.keys())), 8)
- self.assert_('podcast' in dictionary)
- self.assert_('episode' in dictionary)
- self.assert_('action' in dictionary)
- self.assert_('device' in dictionary)
- self.assert_('timestamp' in dictionary)
- self.assert_('started' in dictionary)
- self.assert_('position' in dictionary)
- self.assert_('total' in dictionary)
- self.assertEquals(dictionary['podcast'], FEED_URL_3)
- self.assertEquals(dictionary['episode'], EPISODE_URL_4)
- self.assertEquals(dictionary['action'], 'play')
- self.assertEquals(dictionary['device'], DEVICE_ID_1)
- self.assertEquals(dictionary['timestamp'], self.XML_TIMESTAMP)
- self.assertEquals(dictionary['started'], self.VALID_STARTED)
- self.assertEquals(dictionary['position'], self.VALID_POSITION)
- self.assertEquals(dictionary['total'], self.VALID_TOTAL)
+ self.assertEqual(len(list(dictionary.keys())), 8)
+ self.assertTrue('podcast' in dictionary)
+ self.assertTrue('episode' in dictionary)
+ self.assertTrue('action' in dictionary)
+ self.assertTrue('device' in dictionary)
+ self.assertTrue('timestamp' in dictionary)
+ self.assertTrue('started' in dictionary)
+ self.assertTrue('position' in dictionary)
+ self.assertTrue('total' in dictionary)
+ self.assertEqual(dictionary['podcast'], FEED_URL_3)
+ self.assertEqual(dictionary['episode'], EPISODE_URL_4)
+ self.assertEqual(dictionary['action'], 'play')
+ self.assertEqual(dictionary['device'], DEVICE_ID_1)
+ self.assertEqual(dictionary['timestamp'], self.XML_TIMESTAMP)
+ self.assertEqual(dictionary['started'], self.VALID_STARTED)
+ self.assertEqual(dictionary['position'], self.VALID_POSITION)
+ self.assertEqual(dictionary['total'], self.VALID_TOTAL)
class Test_MygPodderClient(unittest.TestCase):
@@ -222,14 +222,14 @@ def setUp(self):
def set_http_response_value(self, value):
self.fake_client.response_value = value
- def assert_http_request_count(self, count):
- self.assertEquals(len(self.fake_client.requests), count)
+ def assertTruehttp_request_count(self, count):
+ self.assertEqual(len(self.fake_client.requests), count)
def has_put_json_data(self, data, required_method='PUT'):
"""Returns True if the FakeJsonClient has received the given data"""
for method, uri, sent in self.fake_client.requests:
if method == required_method:
- self.assertEquals(sent, data)
+ self.assertEqual(sent, data)
return True
return False
@@ -241,17 +241,17 @@ def has_posted_json_data(self, data):
def test_getSubscriptions_withPodcastDevice(self):
self.set_http_response_value(b'[]')
device = api.PodcastDevice('manatee', 'My Device', 'mobile', 20)
- self.assertEquals(self.client.get_subscriptions(device), [])
- self.assert_http_request_count(1)
+ self.assertEqual(self.client.get_subscriptions(device), [])
+ self.assertTruehttp_request_count(1)
def test_putSubscriptions_withPodcastDevice(self):
self.set_http_response_value(b'')
device = api.PodcastDevice('manatee', 'My Device', 'mobile', 20)
- self.assertEquals(
+ self.assertEqual(
self.client.put_subscriptions(
device, self.ADD), True)
- self.assert_http_request_count(1)
- self.assert_(self.has_put_json_data(self.ADD))
+ self.assertTruehttp_request_count(1)
+ self.assertTrue(self.has_put_json_data(self.ADD))
def test_updateSubscriptions_raisesValueError_onInvalidAddList(self):
self.assertRaises(ValueError,
@@ -334,12 +334,12 @@ def test_updateSubscriptions_returnsUpdateResult(self):
result = self.client.update_subscriptions(DEVICE_ID_1,
self.ADD, self.REMOVE)
# result is a UpdateResult object
- self.assert_(hasattr(result, 'since'))
- self.assert_(hasattr(result, 'update_urls'))
- self.assertEquals(result.since, self.SINCE)
- self.assertEquals(result.update_urls, update_urls_expected)
- self.assert_http_request_count(1)
- self.assert_(self.has_posted_json_data(self.ADD_REMOVE_AS_JSON_UPLOAD))
+ self.assertTrue(hasattr(result, 'since'))
+ self.assertTrue(hasattr(result, 'update_urls'))
+ self.assertEqual(result.since, self.SINCE)
+ self.assertEqual(result.update_urls, update_urls_expected)
+ self.assertTruehttp_request_count(1)
+ self.assertTrue(self.has_posted_json_data(self.ADD_REMOVE_AS_JSON_UPLOAD))
def test_pullSubscriptions_raisesInvalidResponse_onEmptyResponse(self):
self.set_http_response_value(b'')
@@ -442,10 +442,10 @@ def test_pullSubscriptions_returnsChangesListAndTimestamp(self):
"timestamp": 1262103016}
""")
changes = self.client.pull_subscriptions(DEVICE_ID_2)
- self.assertEquals(changes.add, [FEED_URL_1, FEED_URL_2])
- self.assertEquals(changes.remove, [FEED_URL_3, FEED_URL_4])
- self.assertEquals(changes.since, self.SINCE)
- self.assert_http_request_count(1)
+ self.assertEqual(changes.add, [FEED_URL_1, FEED_URL_2])
+ self.assertEqual(changes.remove, [FEED_URL_3, FEED_URL_4])
+ self.assertEqual(changes.since, self.SINCE)
+ self.assertTruehttp_request_count(1)
def test_uploadEpisodeActions_raisesInvalidResponse_onEmptyResponse(self):
self.set_http_response_value(b'')
@@ -471,9 +471,9 @@ def test_uploadEpisodeActions_returnsTimestamp(self):
{"timestamp": 1262103016}
""")
result = self.client.upload_episode_actions(self.ACTIONS)
- self.assertEquals(result, self.SINCE)
- self.assert_http_request_count(1)
- self.assert_(self.has_posted_json_data(self.ACTIONS_AS_JSON_UPLOAD))
+ self.assertEqual(result, self.SINCE)
+ self.assertTruehttp_request_count(1)
+ self.assertTrue(self.has_posted_json_data(self.ACTIONS_AS_JSON_UPLOAD))
def test_downloadEpisodeActions_raisesInvalidResponse_onEmptyResponse(
self):
@@ -535,47 +535,47 @@ def test_downloadEpisodeActions_returnsActionList(self):
], "timestamp": 1262103016}
""")
changes = self.client.download_episode_actions()
- self.assertEquals(len(changes.actions), 2)
+ self.assertEqual(len(changes.actions), 2)
action1, action2 = changes.actions
- self.assertEquals(action1.podcast, 'a')
- self.assertEquals(action1.episode, 'b')
- self.assertEquals(action1.action, 'download')
- self.assertEquals(action2.podcast, 'x')
- self.assertEquals(action2.episode, 'y')
- self.assertEquals(action2.action, 'play')
- self.assertEquals(changes.since, self.SINCE)
- self.assert_http_request_count(1)
+ self.assertEqual(action1.podcast, 'a')
+ self.assertEqual(action1.episode, 'b')
+ self.assertEqual(action1.action, 'download')
+ self.assertEqual(action2.podcast, 'x')
+ self.assertEqual(action2.episode, 'y')
+ self.assertEqual(action2.action, 'play')
+ self.assertEqual(changes.since, self.SINCE)
+ self.assertTruehttp_request_count(1)
def test_updateDeviceSettings_withNothing(self):
self.set_http_response_value(b'')
result = self.client.update_device_settings(DEVICE_ID_1)
- self.assertEquals(result, True)
- self.assert_http_request_count(1)
- self.assert_(self.has_posted_json_data({}))
+ self.assertEqual(result, True)
+ self.assertTruehttp_request_count(1)
+ self.assertTrue(self.has_posted_json_data({}))
def test_updateDeviceSettings_withCaption(self):
self.set_http_response_value(b'')
result = self.client.update_device_settings(DEVICE_ID_1,
caption='Poodonkis')
- self.assertEquals(result, True)
- self.assert_http_request_count(1)
- self.assert_(self.has_posted_json_data({'caption': 'Poodonkis'}))
+ self.assertEqual(result, True)
+ self.assertTruehttp_request_count(1)
+ self.assertTrue(self.has_posted_json_data({'caption': 'Poodonkis'}))
def test_updateDeviceSettings_withType(self):
self.set_http_response_value(b'')
result = self.client.update_device_settings(DEVICE_ID_1,
type='desktop')
- self.assertEquals(result, True)
- self.assert_http_request_count(1)
- self.assert_(self.has_posted_json_data({'type': 'desktop'}))
+ self.assertEqual(result, True)
+ self.assertTruehttp_request_count(1)
+ self.assertTrue(self.has_posted_json_data({'type': 'desktop'}))
def test_updateDeviceSettings_withCaptionAndType(self):
self.set_http_response_value(b'')
result = self.client.update_device_settings(DEVICE_ID_1,
'My Unit Testing Device', 'desktop')
- self.assertEquals(result, True)
- self.assert_http_request_count(1)
- self.assert_(self.has_posted_json_data({
+ self.assertEqual(result, True)
+ self.assertTruehttp_request_count(1)
+ self.assertTrue(self.has_posted_json_data({
'caption': 'My Unit Testing Device',
'type': 'desktop'}))
@@ -610,17 +610,17 @@ def test_getDevices_returnsDeviceList(self):
]
""")
devices = self.client.get_devices()
- self.assertEquals(len(devices), 2)
+ self.assertEqual(len(devices), 2)
device1, device2 = devices
- self.assertEquals(device1.device_id, DEVICE_ID_1)
- self.assertEquals(device1.caption, 'Phone')
- self.assertEquals(device1.type, 'mobile')
- self.assertEquals(device1.subscriptions, 42)
- self.assertEquals(device2.device_id, DEVICE_ID_2)
- self.assertEquals(device2.caption, 'The Lappy')
- self.assertEquals(device2.type, 'laptop')
- self.assertEquals(device2.subscriptions, 4711)
- self.assert_http_request_count(1)
+ self.assertEqual(device1.device_id, DEVICE_ID_1)
+ self.assertEqual(device1.caption, 'Phone')
+ self.assertEqual(device1.type, 'mobile')
+ self.assertEqual(device1.subscriptions, 42)
+ self.assertEqual(device2.device_id, DEVICE_ID_2)
+ self.assertEqual(device2.caption, 'The Lappy')
+ self.assertEqual(device2.type, 'laptop')
+ self.assertEqual(device2.subscriptions, 4711)
+ self.assertTruehttp_request_count(1)
def test_getFavoriteEpisodes_returnsEpisodeList(self):
self.set_http_response_value(b"""
@@ -644,24 +644,24 @@ def test_getFavoriteEpisodes_returnsEpisodeList(self):
]
""")
favorites = self.client.get_favorite_episodes()
- self.assertEquals(len(favorites), 2)
+ self.assertEqual(len(favorites), 2)
episode1, episode2 = favorites
- self.assertEquals(episode1.title, 'TWiT 245: No Hitler For You')
- self.assertEquals(
+ self.assertEqual(episode1.title, 'TWiT 245: No Hitler For You')
+ self.assertEqual(
episode1.url,
'http://www.podtrac.com/pts/redirect.mp3/aolradio.podcast.aol.com/twit/twit0245.mp3')
- self.assertEquals(
+ self.assertEqual(
episode1.podcast_title,
'this WEEK in TECH - MP3 Edition')
- self.assertEquals(episode1.podcast_url, 'http://leo.am/podcasts/twit')
- self.assertEquals(episode1.description, '[...]')
- self.assertEquals(
+ self.assertEqual(episode1.podcast_url, 'http://leo.am/podcasts/twit')
+ self.assertEqual(episode1.description, '[...]')
+ self.assertEqual(
episode1.website,
'http://www.podtrac.com/pts/redirect.mp3/aolradio.podcast.aol.com/twit/twit0245.mp3')
- self.assertEquals(episode1.released, '2010-12-25T00:30:00')
- self.assertEquals(
+ self.assertEqual(episode1.released, '2010-12-25T00:30:00')
+ self.assertEqual(
episode1.mygpo_link,
'http://gpodder.net/episode/1046492')
- self.assertEquals(
+ self.assertEqual(
episode2.website,
'http://feedproxy.google.com/~r/coverville/~3/5UK8-PZmmMQ/')
diff --git a/mygpoclient/http_test.py b/mygpoclient/http_test.py
index 0bb9491..478ba2b 100644
--- a/mygpoclient/http_test.py
+++ b/mygpoclient/http_test.py
@@ -171,12 +171,12 @@ def test_BadRequest(self):
def test_GET(self):
client = HttpClient()
path = self.URI_BASE + '/noauth'
- self.assertEquals(client.GET(path), self.RESPONSE)
+ self.assertEqual(client.GET(path), self.RESPONSE)
def test_authenticated_GET(self):
client = HttpClient(self.USERNAME, self.PASSWORD)
path = self.URI_BASE + '/auth'
- self.assertEquals(client.GET(path), self.RESPONSE)
+ self.assertEqual(client.GET(path), self.RESPONSE)
def test_unauthenticated_GET(self):
client = HttpClient()
@@ -186,7 +186,7 @@ def test_unauthenticated_GET(self):
def test_POST(self):
client = HttpClient()
path = self.URI_BASE + '/noauth'
- self.assertEquals(
+ self.assertEqual(
client.POST(
path, self.DUMMYDATA), codecs.encode(
self.DUMMYDATA.decode('utf-8'), 'rot-13').encode('utf-8'))
@@ -194,7 +194,7 @@ def test_POST(self):
def test_authenticated_POST(self):
client = HttpClient(self.USERNAME, self.PASSWORD)
path = self.URI_BASE + '/auth'
- self.assertEquals(
+ self.assertEqual(
client.POST(
path, self.DUMMYDATA), codecs.encode(
self.DUMMYDATA.decode('utf-8'), 'rot-13').encode('utf-8'))
@@ -207,14 +207,14 @@ def test_unauthenticated_POST(self):
def test_PUT(self):
client = HttpClient()
path = self.URI_BASE + '/noauth'
- self.assertEquals(client.PUT(path, self.DUMMYDATA), b'PUT OK')
+ self.assertEqual(client.PUT(path, self.DUMMYDATA), b'PUT OK')
def test_GET_after_PUT(self):
client = HttpClient()
for i in range(10):
path = self.URI_BASE + '/file.%(i)d.txt' % locals()
client.PUT(path, self.RESPONSE + str(i).encode('utf-8'))
- self.assertEquals(
+ self.assertEqual(
client.GET(path),
self.RESPONSE +
str(i).encode('utf-8'))
diff --git a/mygpoclient/json_test.py b/mygpoclient/json_test.py
index 8517b56..a8a370a 100644
--- a/mygpoclient/json_test.py
+++ b/mygpoclient/json_test.py
@@ -61,17 +61,17 @@ def test_parseResponse_worksWithDictionary(self):
client = json.JsonClient(self.USERNAME, self.PASSWORD)
self.mock_setHttpResponse(b'{"a": "B", "c": "D"}')
items = list(sorted(client.GET(self.URI_BASE + '/').items()))
- self.assertEquals(items, [('a', 'B'), ('c', 'D')])
+ self.assertEqual(items, [('a', 'B'), ('c', 'D')])
def test_parseResponse_worksWithIntegerList(self):
client = json.JsonClient(self.USERNAME, self.PASSWORD)
self.mock_setHttpResponse(b'[1,2,3,6,7]')
- self.assertEquals(client.GET(self.URI_BASE + '/'), [1, 2, 3, 6, 7])
+ self.assertEqual(client.GET(self.URI_BASE + '/'), [1, 2, 3, 6, 7])
def test_parseResponse_emptyString_returnsNone(self):
client = json.JsonClient(self.USERNAME, self.PASSWORD)
self.mock_setHttpResponse(b'')
- self.assertEquals(client.GET(self.URI_BASE + '/'), None)
+ self.assertEqual(client.GET(self.URI_BASE + '/'), None)
def test_invalidContent_raisesJsonException(self):
client = json.JsonClient(self.USERNAME, self.PASSWORD)
diff --git a/mygpoclient/locator_test.py b/mygpoclient/locator_test.py
index f9e30fd..57eca59 100644
--- a/mygpoclient/locator_test.py
+++ b/mygpoclient/locator_test.py
@@ -81,28 +81,28 @@ def test_unsupported_settings_uri_exception2(self):
def test_subscriptions_uri_no_device(self):
"""Test that no device returns user subscriptions"""
- self.assertEquals(self.locator.subscriptions_uri(),
+ self.assertEqual(self.locator.subscriptions_uri(),
'http://gpodder.net/subscriptions/jane.opml')
def test_root_uri(self):
"""Test that root_uri trivially works"""
- self.assertEquals(self.locator.root_uri(),
+ self.assertEqual(self.locator.root_uri(),
'http://gpodder.net')
def test_create_with_url(self):
"""Test locator creation with a root URL instead of host"""
loc = locator.Locator('hello', 'https://gpo.self.hosted/my')
- self.assertEquals(loc.toplist_uri(),
+ self.assertEqual(loc.toplist_uri(),
'https://gpo.self.hosted/my/toplist/50.opml')
def test_create_with_url_slash(self):
"""Test locator creation with a root URL ending with a slash"""
loc = locator.Locator('hello', 'https://gpo.self.hosted/my/')
- self.assertEquals(loc.toplist_uri(),
+ self.assertEqual(loc.toplist_uri(),
'https://gpo.self.hosted/my/toplist/50.opml')
def test_create_with_host(self):
"""Test locator creation with a host"""
loc = locator.Locator('hello', 'gpo.self.hosted')
- self.assertEquals(loc.toplist_uri(),
+ self.assertEqual(loc.toplist_uri(),
'http://gpo.self.hosted/toplist/50.opml')
diff --git a/mygpoclient/public_test.py b/mygpoclient/public_test.py
index 602c834..8287204 100644
--- a/mygpoclient/public_test.py
+++ b/mygpoclient/public_test.py
@@ -172,38 +172,38 @@ def setUp(self):
def test_getToplist(self):
self.fake_client.response_value = self.TOPLIST_JSON
result = self.client.get_toplist()
- self.assertEquals(result, self.TOPLIST)
- self.assertEquals(len(self.fake_client.requests), 1)
+ self.assertEqual(result, self.TOPLIST)
+ self.assertEqual(len(self.fake_client.requests), 1)
def test_searchPodcasts(self):
self.fake_client.response_value = self.SEARCHRESULT_JSON
result = self.client.search_podcasts('wicked')
- self.assertEquals(result, self.SEARCHRESULT)
- self.assertEquals(len(self.fake_client.requests), 1)
+ self.assertEqual(result, self.SEARCHRESULT)
+ self.assertEqual(len(self.fake_client.requests), 1)
def test_getPodcastsOfATag(self):
self.fake_client.response_value = self.SEARCHRESULT_JSON
result = self.client.get_podcasts_of_a_tag('wicked')
- self.assertEquals(result, self.SEARCHRESULT)
- self.assertEquals(len(self.fake_client.requests), 1)
+ self.assertEqual(result, self.SEARCHRESULT)
+ self.assertEqual(len(self.fake_client.requests), 1)
def test_getTopTags(self):
self.fake_client.response_value = self.TOPTAGS_JSON
result = self.client.get_toptags()
- self.assertEquals(result, self.TOPTAGS)
- self.assertEquals(len(self.fake_client.requests), 1)
+ self.assertEqual(result, self.TOPTAGS)
+ self.assertEqual(len(self.fake_client.requests), 1)
def test_getPodcastData(self):
self.fake_client.response_value = self.PODCAST_JSON
result = self.client.get_podcast_data(
'http://feeds.feedburner.com/linuxoutlaws')
- self.assertEquals(result, self.PODCAST)
- self.assertEquals(len(self.fake_client.requests), 1)
+ self.assertEqual(result, self.PODCAST)
+ self.assertEqual(len(self.fake_client.requests), 1)
def test_getEpisodeData(self):
self.fake_client.response_value = self.EPISODE_JSON
result = self.client.get_episode_data(
'http://leo.am/podcasts/twit',
'http://www.podtrac.com/pts/redirect.mp3/aolradio.podcast.aol.com/twit/twit0245.mp3')
- self.assertEquals(result, self.EPISODE)
- self.assertEquals(len(self.fake_client.requests), 1)
+ self.assertEqual(result, self.EPISODE)
+ self.assertEqual(len(self.fake_client.requests), 1)
diff --git a/mygpoclient/simple_test.py b/mygpoclient/simple_test.py
index 6b97361..d93235f 100644
--- a/mygpoclient/simple_test.py
+++ b/mygpoclient/simple_test.py
@@ -87,20 +87,20 @@ def test_putSubscriptions(self):
self.fake_client.response_value = b''
result = self.client.put_subscriptions(
self.DEVICE_NAME, self.SUBSCRIPTIONS)
- self.assertEquals(result, True)
- self.assertEquals(len(self.fake_client.requests), 1)
+ self.assertEqual(result, True)
+ self.assertEqual(len(self.fake_client.requests), 1)
def test_getSubscriptions(self):
self.fake_client.response_value = self.SUBSCRIPTIONS_JSON
subscriptions = self.client.get_subscriptions(self.DEVICE_NAME)
- self.assertEquals(subscriptions, self.SUBSCRIPTIONS)
- self.assertEquals(len(self.fake_client.requests), 1)
+ self.assertEqual(subscriptions, self.SUBSCRIPTIONS)
+ self.assertEqual(len(self.fake_client.requests), 1)
def test_getSuggestions(self):
self.fake_client.response_value = self.SUGGESTIONS_JSON
suggestions = self.client.get_suggestions(50)
- self.assertEquals(suggestions, self.SUGGESTIONS)
- self.assertEquals(len(self.fake_client.requests), 1)
+ self.assertEqual(suggestions, self.SUGGESTIONS)
+ self.assertEqual(len(self.fake_client.requests), 1)
class Test_MissingCredentials(unittest.TestCase):
From a24248f45ab21dfb010d5993eab320be990a7798 Mon Sep 17 00:00:00 2001
From: Gwyn Ciesla <gwync@protonmail.com>
Date: Wed, 6 Sep 2023 08:23:10 -0500
Subject: [PATCH 2/3] Add python versions
---
.github/workflows/publish.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 085bea4..194a005 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -14,7 +14,7 @@ jobs:
github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
strategy:
matrix:
- python-version: ['2.7', '3.6', '3.8', '3.9', '3.10']
+ python-version: ['2.7', '3.6', '3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
From 6a2f7d7d8e873916b3d745281b454b5267bbcaf4 Mon Sep 17 00:00:00 2001
From: Gwyn Ciesla <gwync@protonmail.com>
Date: Thu, 7 Sep 2023 08:49:34 -0500
Subject: [PATCH 3/3] Correct erroneous change.
---
mygpoclient/api_test.py | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/mygpoclient/api_test.py b/mygpoclient/api_test.py
index 3ff2847..50efb68 100644
--- a/mygpoclient/api_test.py
+++ b/mygpoclient/api_test.py
@@ -222,7 +222,7 @@ def setUp(self):
def set_http_response_value(self, value):
self.fake_client.response_value = value
- def assertTruehttp_request_count(self, count):
+ def assert_http_request_count(self, count):
self.assertEqual(len(self.fake_client.requests), count)
def has_put_json_data(self, data, required_method='PUT'):
@@ -242,7 +242,7 @@ def test_getSubscriptions_withPodcastDevice(self):
self.set_http_response_value(b'[]')
device = api.PodcastDevice('manatee', 'My Device', 'mobile', 20)
self.assertEqual(self.client.get_subscriptions(device), [])
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
def test_putSubscriptions_withPodcastDevice(self):
self.set_http_response_value(b'')
@@ -250,7 +250,7 @@ def test_putSubscriptions_withPodcastDevice(self):
self.assertEqual(
self.client.put_subscriptions(
device, self.ADD), True)
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
self.assertTrue(self.has_put_json_data(self.ADD))
def test_updateSubscriptions_raisesValueError_onInvalidAddList(self):
@@ -338,7 +338,7 @@ def test_updateSubscriptions_returnsUpdateResult(self):
self.assertTrue(hasattr(result, 'update_urls'))
self.assertEqual(result.since, self.SINCE)
self.assertEqual(result.update_urls, update_urls_expected)
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
self.assertTrue(self.has_posted_json_data(self.ADD_REMOVE_AS_JSON_UPLOAD))
def test_pullSubscriptions_raisesInvalidResponse_onEmptyResponse(self):
@@ -445,7 +445,7 @@ def test_pullSubscriptions_returnsChangesListAndTimestamp(self):
self.assertEqual(changes.add, [FEED_URL_1, FEED_URL_2])
self.assertEqual(changes.remove, [FEED_URL_3, FEED_URL_4])
self.assertEqual(changes.since, self.SINCE)
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
def test_uploadEpisodeActions_raisesInvalidResponse_onEmptyResponse(self):
self.set_http_response_value(b'')
@@ -472,7 +472,7 @@ def test_uploadEpisodeActions_returnsTimestamp(self):
""")
result = self.client.upload_episode_actions(self.ACTIONS)
self.assertEqual(result, self.SINCE)
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
self.assertTrue(self.has_posted_json_data(self.ACTIONS_AS_JSON_UPLOAD))
def test_downloadEpisodeActions_raisesInvalidResponse_onEmptyResponse(
@@ -544,13 +544,13 @@ def test_downloadEpisodeActions_returnsActionList(self):
self.assertEqual(action2.episode, 'y')
self.assertEqual(action2.action, 'play')
self.assertEqual(changes.since, self.SINCE)
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
def test_updateDeviceSettings_withNothing(self):
self.set_http_response_value(b'')
result = self.client.update_device_settings(DEVICE_ID_1)
self.assertEqual(result, True)
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
self.assertTrue(self.has_posted_json_data({}))
def test_updateDeviceSettings_withCaption(self):
@@ -558,7 +558,7 @@ def test_updateDeviceSettings_withCaption(self):
result = self.client.update_device_settings(DEVICE_ID_1,
caption='Poodonkis')
self.assertEqual(result, True)
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
self.assertTrue(self.has_posted_json_data({'caption': 'Poodonkis'}))
def test_updateDeviceSettings_withType(self):
@@ -566,7 +566,7 @@ def test_updateDeviceSettings_withType(self):
result = self.client.update_device_settings(DEVICE_ID_1,
type='desktop')
self.assertEqual(result, True)
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
self.assertTrue(self.has_posted_json_data({'type': 'desktop'}))
def test_updateDeviceSettings_withCaptionAndType(self):
@@ -574,7 +574,7 @@ def test_updateDeviceSettings_withCaptionAndType(self):
result = self.client.update_device_settings(DEVICE_ID_1,
'My Unit Testing Device', 'desktop')
self.assertEqual(result, True)
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
self.assertTrue(self.has_posted_json_data({
'caption': 'My Unit Testing Device',
'type': 'desktop'}))
@@ -620,7 +620,7 @@ def test_getDevices_returnsDeviceList(self):
self.assertEqual(device2.caption, 'The Lappy')
self.assertEqual(device2.type, 'laptop')
self.assertEqual(device2.subscriptions, 4711)
- self.assertTruehttp_request_count(1)
+ self.assert_http_request_count(1)
def test_getFavoriteEpisodes_returnsEpisodeList(self):
self.set_http_response_value(b"""