Commit 0b6e6298 by JonahStanley

Using requests instead of a HTTPConnect

parent 58bb6e1e
...@@ -101,7 +101,7 @@ MITX_FEATURES['SAUCE'] = { ...@@ -101,7 +101,7 @@ MITX_FEATURES['SAUCE'] = {
'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'), 'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'),
'USERNAME' : os.environ.get('SAUCE_USER_NAME'), 'USERNAME' : os.environ.get('SAUCE_USER_NAME'),
'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), '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'), 'PLATFORM' : os.environ.get('SAUCE_PLATFORM', 'Linux'),
'VERSION' : os.environ.get('SAUCE_VERSION', ''), 'VERSION' : os.environ.get('SAUCE_VERSION', ''),
'DEVICE' : os.environ.get('SAUCE_DEVICE', ''), 'DEVICE' : os.environ.get('SAUCE_DEVICE', ''),
......
...@@ -43,7 +43,7 @@ LOGGER.info("Loading the lettuce acceptance testing terrain file...") ...@@ -43,7 +43,7 @@ LOGGER.info("Loading the lettuce acceptance testing terrain file...")
MAX_VALID_BROWSER_ATTEMPTS = 20 MAX_VALID_BROWSER_ATTEMPTS = 20
# https://gist.github.com/santiycr/1644439 # https://gist.github.com/santiycr/1644439
import httplib import requests
import base64 import base64
try: try:
import json import json
...@@ -75,12 +75,10 @@ base64string = base64.encodestring('{}:{}'.format(config['username'], config['ac ...@@ -75,12 +75,10 @@ base64string = base64.encodestring('{}:{}'.format(config['username'], config['ac
def set_job_status(jobid, passed=True): def set_job_status(jobid, passed=True):
body_content = json.dumps({"passed": passed}) body_content = json.dumps({"passed": passed})
connection = httplib.HTTPConnection("saucelabs.com") result=requests.put('http://saucelabs.com/rest/v1/{}/jobs/{}'.format(config['username'], jobid),
connection.request('PUT', '/rest/v1/%s/jobs/%s' % (config['username'], jobid), data=body_content,
body_content, headers={"Authorization": "Basic {}".format(base64string)})
headers={"Authorization": "Basic %s" % base64string}) return result.status_code == 200
result = connection.getresponse()
return result.status == 200
@before.harvest @before.harvest
......
...@@ -109,7 +109,7 @@ MITX_FEATURES['SAUCE'] = { ...@@ -109,7 +109,7 @@ MITX_FEATURES['SAUCE'] = {
'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'), 'SAUCE_ENABLED' : os.environ.get('SAUCE_ENABLED'),
'USERNAME' : os.environ.get('SAUCE_USER_NAME'), 'USERNAME' : os.environ.get('SAUCE_USER_NAME'),
'ACCESS_ID' : os.environ.get('SAUCE_API_KEY'), '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'), 'PLATFORM' : os.environ.get('SAUCE_PLATFORM', 'Linux'),
'VERSION' : os.environ.get('SAUCE_VERSION', ''), 'VERSION' : os.environ.get('SAUCE_VERSION', ''),
'DEVICE' : os.environ.get('SAUCE_DEVICE', ''), 'DEVICE' : os.environ.get('SAUCE_DEVICE', ''),
...@@ -117,6 +117,7 @@ MITX_FEATURES['SAUCE'] = { ...@@ -117,6 +117,7 @@ MITX_FEATURES['SAUCE'] = {
'BUILD' : os.environ.get('JOB_NAME', 'LMS TESTS'), 'BUILD' : os.environ.get('JOB_NAME', 'LMS TESTS'),
} }
# Include the lettuce app for acceptance testing, including the 'harvest' django-admin command # Include the lettuce app for acceptance testing, including the 'harvest' django-admin command
INSTALLED_APPS += ('lettuce.django',) INSTALLED_APPS += ('lettuce.django',)
LETTUCE_APPS = ('courseware',) 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