'Verify that the resolve_user view is behaving as expected'

def test_resolve_user(self):

    valid_uname_pw = ('%s:%s' % ('admin', 'admin'))
    invalid_uname_pw = ('%s:%s' % ('n0t', 'v@l1d'))
    valid_auth_headers = {'HTTP_AUTHORIZATION': ('basic    ' + base64.b64encode(valid_uname_pw))}
    invalid_auth_headers = {'HTTP_AUTHORIZATION': ('basic    ' + base64.b64encode(invalid_uname_pw))}
    response = self.client.get(reverse('layer_resolve_user'), **valid_auth_headers)
    response_json = json.loads(response.content)
    self.assertEquals({'geoserver': False, 'superuser': True, 'user': 'admin', 'fullname': 'admin', 'email': ''}, response_json)
    response = self.client.get(reverse('layer_acls'), **invalid_auth_headers)
    self.assertEquals(response.status_code, 401)
    self.client.login(username='admin', password='admin')
    response = self.client.get(reverse('layer_resolve_user'))
    response_json = json.loads(response.content)
    self.assertEquals('admin', response_json['user'])
    self.assertEquals('admin', response_json['fullname'])
    self.assertEquals('', response_json['email'])
