Fixed a bug800348, where users failed to be created if bind_port wasn't defined in the config.

This commit is contained in:
Joe Arnold 2011-06-27 15:02:32 +00:00 committed by Tarmac
commit 3d112ecfdb
2 changed files with 19 additions and 1 deletions

View File

@ -85,7 +85,7 @@ class TempAuth(object):
if ip == '0.0.0.0':
ip = '127.0.0.1'
url += ip
url += ':' + conf.get('bind_port', 80) + '/v1/' + \
url += ':' + conf.get('bind_port', '8080') + '/v1/' + \
self.reseller_prefix + conf_key.split('_')[1]
groups = values
self.users[conf_key.split('_', 1)[1].replace('_', ':')] = {

View File

@ -384,5 +384,23 @@ class TestAuth(unittest.TestCase):
self.assertEquals(resp.status_int, 401)
class TestParseUserCreation(unittest.TestCase):
def test_parse_user_creation(self):
auth_filter = auth.filter_factory({
'user_test_tester3': 'testing',
'user_admin_admin': 'admin .admin .reseller_admin',
})(FakeApp())
self.assertEquals(auth_filter.users, {
'admin:admin': {
'url': 'http://127.0.0.1:8080/v1/AUTH_admin',
'groups': ['.admin', '.reseller_admin'],
'key': 'admin'
}, 'test:tester3': {
'url': 'http://127.0.0.1:8080/v1/AUTH_test',
'groups': [],
'key': 'testing'
},
})
if __name__ == '__main__':
unittest.main()