-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Alfred 3-only updates
- Loading branch information
Showing
18 changed files
with
481 additions
and
120 deletions.
There are no files selected for viewing
Binary file not shown.
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,5 @@ | ||
pytest==2.8.7 | ||
pytest-cov==2.2.1 | ||
pytest-httpbin==0.2.0 | ||
pytest-localserver==0.3.5 | ||
tox==2.3.1 |
File renamed without changes.
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,78 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>bundleid</key> | ||
<string>net.deanishe.alfred-workflow</string> | ||
<key>connections</key> | ||
<dict/> | ||
<key>createdby</key> | ||
<string>Dean Jackson</string> | ||
<key>description</key> | ||
<string>Test alfred-workflow library</string> | ||
<key>disabled</key> | ||
<false/> | ||
<key>name</key> | ||
<string>Alfred-Workflow Test</string> | ||
<key>objects</key> | ||
<array> | ||
<dict> | ||
<key>config</key> | ||
<dict> | ||
<key>alfredfiltersresults</key> | ||
<false/> | ||
<key>argumenttype</key> | ||
<integer>0</integer> | ||
<key>escaping</key> | ||
<integer>102</integer> | ||
<key>keyword</key> | ||
<string>wftest</string> | ||
<key>queuedelaycustom</key> | ||
<integer>1</integer> | ||
<key>queuedelayimmediatelyinitially</key> | ||
<false/> | ||
<key>queuedelaymode</key> | ||
<integer>0</integer> | ||
<key>queuemode</key> | ||
<integer>1</integer> | ||
<key>runningsubtext</key> | ||
<string>Doin' stuff…</string> | ||
<key>script</key> | ||
<string>python test.py "$@"</string> | ||
<key>scriptargtype</key> | ||
<integer>1</integer> | ||
<key>scriptfile</key> | ||
<string></string> | ||
<key>subtext</key> | ||
<string>Test alfred-workflow Python lib</string> | ||
<key>title</key> | ||
<string>Alfred-Workflow Test</string> | ||
<key>type</key> | ||
<integer>0</integer> | ||
<key>withspace</key> | ||
<true/> | ||
</dict> | ||
<key>type</key> | ||
<string>alfred.workflow.input.scriptfilter</string> | ||
<key>uid</key> | ||
<string>5F480F88-2088-4D34-B621-ACEBCB5E6753</string> | ||
<key>version</key> | ||
<integer>2</integer> | ||
</dict> | ||
</array> | ||
<key>readme</key> | ||
<string></string> | ||
<key>uidata</key> | ||
<dict> | ||
<key>5F480F88-2088-4D34-B621-ACEBCB5E6753</key> | ||
<dict> | ||
<key>xpos</key> | ||
<integer>30</integer> | ||
<key>ypos</key> | ||
<integer>30</integer> | ||
</dict> | ||
</dict> | ||
<key>webaddress</key> | ||
<string></string> | ||
</dict> | ||
</plist> |
This file was deleted.
Oops, something went wrong.
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,135 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
# | ||
# Copyright (c) 2014 Fabio Niephaus <[email protected]>, | ||
# Dean Jackson <[email protected]> | ||
# | ||
# MIT Licence. See http://opensource.org/licenses/MIT | ||
# | ||
# Created on 2014-08-16 | ||
# | ||
|
||
# TODO: Offline tests using pytest_localserver | ||
|
||
""" | ||
test_update_alfred3.py | ||
""" | ||
|
||
from __future__ import print_function | ||
|
||
import os | ||
|
||
import pytest | ||
|
||
from util import create_info_plist, delete_info_plist, INFO_PLIST_TEST3 | ||
from workflow import update | ||
|
||
|
||
@pytest.fixture(scope='module') | ||
def info(request): | ||
"""Ensure `info.plist` exists in the working directory.""" | ||
create_info_plist() | ||
os.environ['alfred_version'] = '2.4' | ||
update._wf = None | ||
request.addfinalizer(delete_info_plist) | ||
|
||
|
||
@pytest.fixture(scope='module') | ||
def info3(request): | ||
"""Ensure `info.plist` exists in the working directory.""" | ||
create_info_plist(INFO_PLIST_TEST3) | ||
os.environ['alfred_version'] = '3.0.2' | ||
update._wf = None | ||
request.addfinalizer(delete_info_plist) | ||
|
||
|
||
def test_valid_releases_alfred2(info): | ||
"""Valid releases for Alfred 2.""" | ||
# Valid release for 2 & 3 | ||
r = update._validate_release({'tag_name': 'v1.2', 'assets': [ | ||
{'browser_download_url': | ||
'blah.alfredworkflow'}], | ||
'prerelease': False}) | ||
|
||
assert r is not None | ||
assert r['prerelease'] is False | ||
assert r['download_url'] == 'blah.alfredworkflow' | ||
|
||
# Valid release for 3 only | ||
r = update._validate_release({'tag_name': 'v1.2', 'assets': [ | ||
{'browser_download_url': | ||
'blah.alfred3workflow'}], | ||
'prerelease': False}) | ||
|
||
assert r is None | ||
|
||
# Invalid release | ||
r = update._validate_release({'tag_name': 'v1.2', 'assets': [ | ||
{'browser_download_url': | ||
'blah.alfred3workflow'}, | ||
{'browser_download_url': | ||
'blah2.alfred3workflow'}], | ||
'prerelease': False}) | ||
|
||
assert r is None | ||
|
||
# Valid for 2 & 3 with separate workflows | ||
r = update._validate_release({'tag_name': 'v1.2', 'assets': [ | ||
{'browser_download_url': | ||
'blah.alfredworkflow'}, | ||
{'browser_download_url': | ||
'blah.alfred3workflow'}], | ||
'prerelease': False}) | ||
|
||
assert r is not None | ||
assert r['version'] == 'v1.2' | ||
assert r['download_url'] == 'blah.alfredworkflow' | ||
|
||
|
||
def test_valid_releases_alfred3(info3): | ||
"""Valid releases for Alfred 3.""" | ||
# Valid release for 2 & 3 | ||
r = update._validate_release({'tag_name': 'v1.2', 'assets': [ | ||
{'browser_download_url': | ||
'blah.alfredworkflow'}], | ||
'prerelease': False}) | ||
|
||
assert r is not None | ||
assert r['download_url'] == 'blah.alfredworkflow' | ||
|
||
# Valid release for 3 only | ||
print('alfred_version=', os.environ['alfred_version']) | ||
print('version=', update.wf().alfred_version) | ||
r = update._validate_release({'tag_name': 'v1.2', 'assets': [ | ||
{'browser_download_url': | ||
'blah.alfred3workflow'}], | ||
'prerelease': False}) | ||
|
||
assert r is not None | ||
assert r['download_url'] == 'blah.alfred3workflow' | ||
|
||
# Invalid release | ||
r = update._validate_release({'tag_name': 'v1.2', 'assets': [ | ||
{'browser_download_url': | ||
'blah.alfred3workflow'}, | ||
{'browser_download_url': | ||
'blah2.alfred3workflow'}], | ||
'prerelease': False}) | ||
|
||
assert r is None | ||
|
||
# Valid for 2 & 3 with separate workflows | ||
r = update._validate_release({'tag_name': 'v1.2', 'assets': [ | ||
{'browser_download_url': | ||
'blah.alfredworkflow'}, | ||
{'browser_download_url': | ||
'blah.alfred3workflow'}], | ||
'prerelease': False}) | ||
|
||
assert r is not None | ||
assert r['version'] == 'v1.2' | ||
assert r['download_url'] == 'blah.alfred3workflow' | ||
|
||
|
||
if __name__ == '__main__': # pragma: no cover | ||
pytest.main([__file__]) |
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
Oops, something went wrong.