aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Crute <mcrute@gmail.com>2015-12-05 19:11:24 -0800
committerMike Crute <mcrute@gmail.com>2015-12-05 19:11:24 -0800
commit7e2925d6fff4b055d683bcfe19ca35280cae5296 (patch)
tree200f71b4c99f9d241f624a4f629b0d27b0aa68b5 /tests
parent31665455768fd8bf11eaa763942f87447b50a384 (diff)
downloadpydora-7e2925d6fff4b055d683bcfe19ca35280cae5296.tar.bz2
pydora-7e2925d6fff4b055d683bcfe19ca35280cae5296.tar.xz
pydora-7e2925d6fff4b055d683bcfe19ca35280cae5296.zip
Remove ad support flag from tests
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pandora/pianobar.cfg1
-rw-r--r--tests/test_pandora/pydora.cfg1
-rw-r--r--tests/test_pandora/test_client.py37
-rw-r--r--tests/test_pandora/test_clientbuilder.py6
4 files changed, 1 insertions, 44 deletions
diff --git a/tests/test_pandora/pianobar.cfg b/tests/test_pandora/pianobar.cfg
index 7a0ffd8..7a915d8 100644
--- a/tests/test_pandora/pianobar.cfg
+++ b/tests/test_pandora/pianobar.cfg
@@ -1,6 +1,5 @@
1# high-quality audio (192k mp3, for Pandora One subscribers only!) 1# high-quality audio (192k mp3, for Pandora One subscribers only!)
2audio_quality = test_quality 2audio_quality = test_quality
3ad_support_enabled = test_ad_support
4rpc_host = test_host 3rpc_host = test_host
5partner_user = test_partner_username 4partner_user = test_partner_username
6partner_password = test_partner_password 5partner_password = test_partner_password
diff --git a/tests/test_pandora/pydora.cfg b/tests/test_pandora/pydora.cfg
index fb75e2f..854e377 100644
--- a/tests/test_pandora/pydora.cfg
+++ b/tests/test_pandora/pydora.cfg
@@ -6,7 +6,6 @@ username = test_partner_username
6password = test_partner_password 6password = test_partner_password
7device = test_device 7device = test_device
8default_audio_quality = test_quality 8default_audio_quality = test_quality
9ad_support_enabled = test_ad_support
10 9
11[user] 10[user]
12username = test_username 11username = test_username
diff --git a/tests/test_pandora/test_client.py b/tests/test_pandora/test_client.py
index 6c14f50..835dc0d 100644
--- a/tests/test_pandora/test_client.py
+++ b/tests/test_pandora/test_client.py
@@ -19,33 +19,11 @@ class TestCallingAPIClient(TestCase):
19 client._authenticate.assert_called_with() 19 client._authenticate.assert_called_with()
20 transport.assert_has_calls([call("method"), call("method")]) 20 transport.assert_has_calls([call("method"), call("method")])
21 21
22 def test_get_params_dict_ad_support_enabled(self):
23 transport = Mock(side_effect=[InvalidAuthToken(), None])
24
25 reg_dict = dict(x=1, y=2)
26 ad_dict = dict(z=3)
27
28 client = BaseAPIClient(transport, None, None, None, None, True)
29 result_dict = client.get_params_dict(reg_dict, ad_dict)
30
31 assert 'z' in result_dict
32
33 def test_get_params_dict_ad_support_disabled(self):
34 transport = Mock(side_effect=[InvalidAuthToken(), None])
35
36 reg_dict = dict(x=1, y=2)
37 ad_dict = dict(z=3)
38
39 client = BaseAPIClient(transport, None, None, None, None, False)
40 result_dict = client.get_params_dict(reg_dict, ad_dict)
41
42 assert not 'z' in result_dict
43
44 def test_ad_support_enabled_parameters(self): 22 def test_ad_support_enabled_parameters(self):
45 with patch.object(APIClient, '__call__') as playlist_mock: 23 with patch.object(APIClient, '__call__') as playlist_mock:
46 transport = Mock(side_effect=[InvalidAuthToken(), None]) 24 transport = Mock(side_effect=[InvalidAuthToken(), None])
47 25
48 client = APIClient(transport, None, None, None, None, True) 26 client = APIClient(transport, None, None, None, None)
49 client._authenticate = Mock() 27 client._authenticate = Mock()
50 28
51 client.get_playlist('mock_token') 29 client.get_playlist('mock_token')
@@ -55,16 +33,3 @@ class TestCallingAPIClient(TestCase):
55 includeTrackLength=True, 33 includeTrackLength=True,
56 stationToken='mock_token', 34 stationToken='mock_token',
57 xplatformAdCapable=True)]) 35 xplatformAdCapable=True)])
58
59 def test_ad_support_disabled_parameters(self):
60 with patch.object(APIClient, '__call__') as playlist_mock:
61 transport = Mock(side_effect=[InvalidAuthToken(), None])
62
63 client = APIClient(transport, None, None, None, None, False)
64 client._authenticate = Mock()
65
66 client.get_playlist('mock_token')
67
68 playlist_mock.assert_has_calls([call("station.getPlaylist",
69 includeTrackLength=True,
70 stationToken='mock_token')])
diff --git a/tests/test_pandora/test_clientbuilder.py b/tests/test_pandora/test_clientbuilder.py
index d4f8db0..27117b0 100644
--- a/tests/test_pandora/test_clientbuilder.py
+++ b/tests/test_pandora/test_clientbuilder.py
@@ -82,7 +82,6 @@ class TestSettingsDictBuilder(TestCase):
82 "DEVICE": "dev", 82 "DEVICE": "dev",
83 "PROXY": "proxy.example.com", 83 "PROXY": "proxy.example.com",
84 "AUDIO_QUALITY": "high", 84 "AUDIO_QUALITY": "high",
85 "AD_SUPPORT_ENABLED": True,
86 "API_HOST": "example.com", 85 "API_HOST": "example.com",
87 }).build() 86 }).build()
88 87
@@ -98,8 +97,6 @@ class TestSettingsDictBuilder(TestCase):
98 self.assertEqual(DEFAULT_API_HOST, client.transport.api_host) 97 self.assertEqual(DEFAULT_API_HOST, client.transport.api_host)
99 self.assertEqual(APIClient.MED_AUDIO_QUALITY, 98 self.assertEqual(APIClient.MED_AUDIO_QUALITY,
100 client.default_audio_quality) 99 client.default_audio_quality)
101 self.assertEqual(True,
102 client.ad_support_enabled)
103 100
104 def test_validate_client(self): 101 def test_validate_client(self):
105 client = TestSettingsDictBuilder._build_maximal() 102 client = TestSettingsDictBuilder._build_maximal()
@@ -118,7 +115,6 @@ class TestSettingsDictBuilder(TestCase):
118 self.assertEqual(expected_proxies, client.transport._http.proxies) 115 self.assertEqual(expected_proxies, client.transport._http.proxies)
119 self.assertEqual("example.com", client.transport.api_host) 116 self.assertEqual("example.com", client.transport.api_host)
120 self.assertEqual("high", client.default_audio_quality) 117 self.assertEqual("high", client.default_audio_quality)
121 self.assertEqual(True, client.ad_support_enabled)
122 118
123 119
124class TestFileBasedBuilder(TestCase): 120class TestFileBasedBuilder(TestCase):
@@ -185,7 +181,6 @@ class TestPydoraConfigFileBuilder(TestCase):
185 181
186 self.assertDictEqual(cfg, { 182 self.assertDictEqual(cfg, {
187 "AUDIO_QUALITY": "test_quality", 183 "AUDIO_QUALITY": "test_quality",
188 "AD_SUPPORT_ENABLED": "test_ad_support",
189 "DECRYPTION_KEY": "test_decryption_key", 184 "DECRYPTION_KEY": "test_decryption_key",
190 "DEVICE": "test_device", 185 "DEVICE": "test_device",
191 "ENCRYPTION_KEY": "test_encryption_key", 186 "ENCRYPTION_KEY": "test_encryption_key",
@@ -207,7 +202,6 @@ class TestPianobarConfigFileBuilder(TestCase):
207 202
208 self.assertDictEqual(cfg, { 203 self.assertDictEqual(cfg, {
209 "AUDIO_QUALITY": "test_qualityQuality", 204 "AUDIO_QUALITY": "test_qualityQuality",
210 "AD_SUPPORT_ENABLED": "test_ad_support",
211 "DECRYPTION_KEY": "test_decryption_key", 205 "DECRYPTION_KEY": "test_decryption_key",
212 "DEVICE": "test_device", 206 "DEVICE": "test_device",
213 "ENCRYPTION_KEY": "test_encryption_key", 207 "ENCRYPTION_KEY": "test_encryption_key",