]> kaliko git repositories - python-musicpd.git/blobdiff - test.py
More robust MPD_HOST parsing
[python-musicpd.git] / test.py
diff --git a/test.py b/test.py
index fc7e385c245f3a96481159f13381ea65b2c169c4..ecf62ffb6c70e70fc28abc8f668644c00003aa3a 100755 (executable)
--- a/test.py
+++ b/test.py
@@ -68,6 +68,13 @@ class testEnvVar(unittest.TestCase):
         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()