summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py5
-rw-r--r--bitbake/lib/bb/tests/fetch.py14
2 files changed, 17 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 05999607b9..4335e7a0d8 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -321,9 +321,10 @@ class URI(object):
321 321
322 @username.setter 322 @username.setter
323 def username(self, username): 323 def username(self, username):
324 password = self.password
324 self.userinfo = username 325 self.userinfo = username
325 if self.password: 326 if password:
326 self.userinfo += ":%s" % self.password 327 self.userinfo += ":%s" % password
327 328
328 @property 329 @property
329 def password(self): 330 def password(self):
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 4fb2178595..4be5a07bec 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -274,6 +274,20 @@ class URITest(unittest.TestCase):
274 self.assertEqual(uri.username, test['username']) 274 self.assertEqual(uri.username, test['username'])
275 self.assertEqual(uri.password, test['password']) 275 self.assertEqual(uri.password, test['password'])
276 276
277 # make sure changing the values doesn't do anything unexpected
278 uri.username = 'changeme'
279 self.assertEqual(uri.username, 'changeme')
280 self.assertEqual(uri.password, test['password'])
281 uri.password = 'insecure'
282 self.assertEqual(uri.username, 'changeme')
283 self.assertEqual(uri.password, 'insecure')
284
285 # reset back after our trickery
286 uri.userinfo = test['userinfo']
287 self.assertEqual(uri.userinfo, test['userinfo'])
288 self.assertEqual(uri.username, test['username'])
289 self.assertEqual(uri.password, test['password'])
290
277 uri.hostname = test['hostname'] 291 uri.hostname = test['hostname']
278 self.assertEqual(uri.hostname, test['hostname']) 292 self.assertEqual(uri.hostname, test['hostname'])
279 self.assertEqual(uri.hostport, test['hostname']) 293 self.assertEqual(uri.hostport, test['hostname'])