self.pwd = mpd_host_env[0]
if mpd_host_env[1]:
self.host = mpd_host_env[1]
- else:
+ elif mpd_host_env[1]:
# No password set but leading @ is an abstract socket
self.host = '@'+mpd_host_env[1]
else:
self.assertEqual(client.pwd, 'pa55w04d')
self.assertEqual(client.host, 'localhost')
+ # Test badly formatted MPD_HOST
+ os.environ['MPD_HOST'] = '@'
+ with mock.patch('os.path.exists', return_value=False):
+ client = musicpd.MPDClient()
+ self.assertEqual(client.pwd, None)
+ self.assertEqual(client.host, 'localhost')
+
# Test unix socket extraction
os.environ['MPD_HOST'] = 'pa55w04d@/unix/sock'
client = musicpd.MPDClient()