functional_tests: Fix site.is_available not handling default paths

Sites might have default paths like /mediawiki/Main_Page or /transmission/web.
The tests are doing an exact match on the path which is causing test failures.
Modified the support function site.is_available to handle default paths.

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Joseph Nuthalpati 2019-08-16 22:53:25 +05:30 committed by Sunil Mohan Adapa
parent 7df4219bce
commit fe02b9f1e3
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -51,8 +51,9 @@ def is_available(browser, site_name):
time.sleep(3)
browser.reload()
not_404 = '404' not in browser.title
# A trailing slash might be appended by Apache redirect rules
no_redirect = url_to_visit.strip('/') == browser.url.strip('/')
# The site might have a default path after the sitename,
# e.g /mediawiki/Main_Page
no_redirect = browser.url.startswith(url_to_visit.strip('/'))
return not_404 and no_redirect