'Check whether a given container ACL is granted when a user specified
by account_b attempts to access a container.'

def _assert_cross_account_acl_granted(self, granted, grantee_account, acl):

    first_account = retry(self._get_account, use_account=self.account)
    def get2(url, token, parsed, conn):
        conn.request('GET', ((first_account + '/') + self.name), '', {'X-Auth-Token': token})
        return check_response(conn)
    resp = retry(get2, use_account=grantee_account)
    resp.read()
    self.assertEqual(resp.status, 403)
    def put2(url, token, parsed, conn):
        conn.request('PUT', (((first_account + '/') + self.name) + '/object'), 'test    object', {'X-Auth-Token': token})
        return check_response(conn)
    resp = retry(put2, use_account=grantee_account)
    resp.read()
    self.assertEqual(resp.status, 403)
    def post(url, token, parsed, conn):
        conn.request('POST', ((parsed.path + '/') + self.name), '', {'X-Auth-Token': token, 'X-Container-Read': acl, 'X-Container-Write': acl})
        return check_response(conn)
    resp = retry(post, use_account=self.account)
    resp.read()
    self.assertEqual(resp.status, 204)
    resp = retry(get2, use_account=grantee_account)
    resp.read()
    expected = (204 if granted else 403)
    self.assertEqual(resp.status, expected)
    resp = retry(put2, use_account=grantee_account)
    resp.read()
    expected = (201 if granted else 403)
    self.assertEqual(resp.status, expected)
    def post(url, token, parsed, conn):
        conn.request('POST', ((parsed.path + '/') + self.name), '', {'X-Auth-Token': token, 'X-Container-Read': '', 'X-Container-Write': ''})
        return check_response(conn)
    resp = retry(post, use_account=self.account)
    resp.read()
    self.assertEqual(resp.status, 204)
    resp = retry(get2, use_account=grantee_account)
    resp.read()
    self.assertEqual(resp.status, 403)
    resp = retry(put2, use_account=grantee_account)
    resp.read()
    self.assertEqual(resp.status, 403)
