From 4a225ee291bea00366fa37ede1f1731bf1b4ada8 Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Thu, 10 Sep 2015 05:07:14 +0100 Subject: [PATCH 1/3] Allow a custom music section name to be provided when generating a response --- test/test_plexupdate.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test_plexupdate.py b/test/test_plexupdate.py index 942d9185b..1699890f8 100644 --- a/test/test_plexupdate.py +++ b/test/test_plexupdate.py @@ -8,9 +8,12 @@ import responses class PlexUpdateTest(unittest.TestCase, TestHelper): - def add_response_get_music_section(self): + def add_response_get_music_section(self, section_name = 'Music'): """Create response for mocking the get_music_section function. """ + + escaped_section_name = section_name.replace('"', '\\"') + body = ( '' '' ' Date: Thu, 10 Sep 2015 05:08:16 +0100 Subject: [PATCH 2/3] Add test for custom named music section (`library_name` property) (#1595) --- test/test_plexupdate.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/test_plexupdate.py b/test/test_plexupdate.py index 1699890f8..67796e3b2 100644 --- a/test/test_plexupdate.py +++ b/test/test_plexupdate.py @@ -94,6 +94,17 @@ class PlexUpdateTest(unittest.TestCase, TestHelper): self.config['plex']['token'], self.config['plex']['library_name'].get()), '2') + @responses.activate + def test_get_named_music_section(self): + # Adding response. + self.add_response_get_music_section('My Music Library') + + self.assertEqual(get_music_section( + self.config['plex']['host'], + self.config['plex']['port'], + self.config['plex']['token'], + 'My Music Library'), '2') + @responses.activate def test_update_plex(self): # Adding responses. From 622c5d1e0f06004ba2b39ba941118eb37385c5e5 Mon Sep 17 00:00:00 2001 From: Jack Wilsdon Date: Thu, 10 Sep 2015 05:14:07 +0100 Subject: [PATCH 3/3] Fix unexpected spaces around keyword / parameter equals --- test/test_plexupdate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_plexupdate.py b/test/test_plexupdate.py index 67796e3b2..58388f728 100644 --- a/test/test_plexupdate.py +++ b/test/test_plexupdate.py @@ -8,7 +8,7 @@ import responses class PlexUpdateTest(unittest.TestCase, TestHelper): - def add_response_get_music_section(self, section_name = 'Music'): + def add_response_get_music_section(self, section_name='Music'): """Create response for mocking the get_music_section function. """