summaryrefslogtreecommitdiffstats
path: root/lib/bb/tests
diff options
context:
space:
mode:
authorOlof Johansson <olof.johansson@axis.com>2014-01-20 12:03:24 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-24 10:13:25 +0000
commit25faef3a047f9c7564089463d7c96f6910b640cb (patch)
tree2eb9b7f604f2fca724ced45cf85acdc4fb3d5458 /lib/bb/tests
parentc2f27ae4271985b48f957747b6ea372c8699cb49 (diff)
downloadopenembedded-core-contrib-25faef3a047f9c7564089463d7c96f6910b640cb.tar.gz
fetch2.URI: Set username/password should not change the other
When setting the username after already having set the password, the password was unexpectedly reset. This change fixes this issue and introduces unit tests to make sure it doesn't happen again. Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/tests')
-rw-r--r--lib/bb/tests/fetch.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 4fb2178595..4be5a07bec 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -274,6 +274,20 @@ class URITest(unittest.TestCase):
self.assertEqual(uri.username, test['username'])
self.assertEqual(uri.password, test['password'])
+ # make sure changing the values doesn't do anything unexpected
+ uri.username = 'changeme'
+ self.assertEqual(uri.username, 'changeme')
+ self.assertEqual(uri.password, test['password'])
+ uri.password = 'insecure'
+ self.assertEqual(uri.username, 'changeme')
+ self.assertEqual(uri.password, 'insecure')
+
+ # reset back after our trickery
+ uri.userinfo = test['userinfo']
+ self.assertEqual(uri.userinfo, test['userinfo'])
+ self.assertEqual(uri.username, test['username'])
+ self.assertEqual(uri.password, test['password'])
+
uri.hostname = test['hostname']
self.assertEqual(uri.hostname, test['hostname'])
self.assertEqual(uri.hostport, test['hostname'])