mediawiki: Fix tests to allow running from any directory

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-03-05 15:28:16 -08:00 committed by James Valleroy
parent cb15d34482
commit e7181bb18a
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -17,6 +17,7 @@
import logging
import os
import pathlib
import time
import requests
@ -125,8 +126,9 @@ def upload_image_mediawiki(browser, username, password, image):
# Upload file
browser.visit(config['DEFAULT']['url'] + '/mediawiki/Special:Upload')
file_path = os.path.realpath('../static/themes/default/img/' + image)
browser.attach_file('wpUploadFile', file_path)
file_path = pathlib.Path(__file__).parent
file_path /= '../../static/themes/default/img/' + image
browser.attach_file('wpUploadFile', str(file_path.resolve()))
interface.submit(browser, element=browser.find_by_name('wpUpload')[0])