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 authored and Sunil Mohan Adapa committed 2019-08-18 13:33:08 -07:00
1 parent 7df4219bce
commit fe02b9f1e3
1 file changed
+3 -2
+3 -2
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