1 # Copyright 2016 The Chromium OS Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 import requests 6 7 from autotest_lib.client.common_lib import error 8 from autotest_lib.server import test 9 10 class brillo_WebservdSanity(test.test): 11 """Verify that webservd delegates requests to clients.""" 12 version = 1 13 14 def run_once(self, host=None): 15 """Body of the test.""" 16 host.adb_run('forward tcp:8998 tcp:80') 17 host.run('start webservd_tclient') 18 r = requests.get('http://localhost:8998/webservd-test-client/ping') 19 if r.status_code != 200: 20 raise error.TestFail('Expected successful http request but ' 21 'status=%d' % r.status_code) 22 if r.text != 'Still alive, still alive!\n': 23 raise error.TestFail('Unexpected response: %s' % r.text) 24