Commit 0b6e6298 by JonahStanley

Using requests instead of a HTTPConnect

parent 58bb6e1e
......@@ -101,7 +101,7 @@ MITX_FEATURES['SAUCE'] = {
'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'),
'USERNAME' : os.environ.get('SAUCE_USER_NAME'),
'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'),
'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome'), DesiredCapabilities.CHROME),
'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome').lower(), DesiredCapabilities.CHROME),
'PLATFORM' : os.environ.get('SAUCE_PLATFORM', 'Linux'),
'VERSION' : os.environ.get('SAUCE_VERSION', ''),
'DEVICE' : os.environ.get('SAUCE_DEVICE', ''),
......
......@@ -43,7 +43,7 @@ LOGGER.info("Loading the lettuce acceptance testing terrain file...")
MAX_VALID_BROWSER_ATTEMPTS = 20
# https://gist.github.com/santiycr/1644439
import httplib
import requests
import base64
try:
import json
......@@ -75,12 +75,10 @@ base64string = base64.encodestring('{}:{}'.format(config['username'], config['ac
def set_job_status(jobid, passed=True):
body_content = json.dumps({"passed": passed})
connection = httplib.HTTPConnection("saucelabs.com")
connection.request('PUT', '/rest/v1/%s/jobs/%s' % (config['username'], jobid),
body_content,
headers={"Authorization": "Basic %s" % base64string})
result = connection.getresponse()
return result.status == 200
result=requests.put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], jobid),
data=body_content,
headers={"Authorization": "Basic {}".format(base64string)})
return result.status_code == 200
@before.harvest
......
......@@ -109,7 +109,7 @@ MITX_FEATURES['SAUCE'] = {
'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'),
'USERNAME' : os.environ.get('SAUCE_USER_NAME'),
'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'),
'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome'), DesiredCapabilities.CHROME),
'BROWSER' : DESIRED_CAPABILITIES.get(os.environ.get('SAUCE_BROWSER', 'chrome').lower(), DesiredCapabilities.CHROME),
'PLATFORM' : os.environ.get('SAUCE_PLATFORM', 'Linux'),
'VERSION' : os.environ.get('SAUCE_VERSION', ''),
'DEVICE' : os.environ.get('SAUCE_DEVICE', ''),
......@@ -117,6 +117,7 @@ MITX_FEATURES['SAUCE'] = {
'BUILD' : os.environ.get('JOB_NAME', 'LMS TESTS'),
}
# Include the lettuce app for acceptance testing, including the 'harvest' django-admin command
INSTALLED_APPS += ('lettuce.django',)
LETTUCE_APPS = ('courseware',)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment