-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from legacy sauce storage (#375)
- Loading branch information
Showing
4 changed files
with
50 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import os | ||
|
||
import requests | ||
|
||
|
||
SAUCE_USERNAME = os.getenv('SAUCE_USERNAME') | ||
SAUCE_ACCESS_KEY = os.getenv('SAUCE_ACCESS_KEY') | ||
SAUCE_UPLOAD_URL = 'https://api.us-west-1.saucelabs.com/v1/storage/upload' | ||
|
||
APP_URL = ( | ||
'https://github.com/jsfehler/stere_ios_test_app/' | ||
'raw/master/build/stere_ios_test_app.zip' | ||
) | ||
APP_FILENAME = 'stere_ios_test_app.zip' | ||
|
||
|
||
def get_app(): | ||
"""Download the test app and save it to disk.""" | ||
response = requests.get(APP_URL) | ||
|
||
with open(APP_FILENAME, 'wb') as f: | ||
for block in response.iter_content(): | ||
f.write(block) | ||
|
||
|
||
def upload_app_to_sauce(): | ||
"""Upload the test app to sauce labs.""" | ||
with open(APP_FILENAME, 'rb') as f: | ||
response = requests.post( | ||
SAUCE_UPLOAD_URL, | ||
files={'payload': f, 'name': APP_FILENAME}, | ||
auth=(SAUCE_USERNAME, SAUCE_ACCESS_KEY), | ||
) | ||
|
||
return response | ||
|
||
|
||
if __name__ == '__main__': | ||
# Upload the IOS test app to sauce storage before running any tests. | ||
get_app() | ||
upload_app_to_sauce() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters