-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
278 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.0.1 | ||
3.0.0 |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
elastic-git>=1.1.0 | ||
elastic-git>=1.4.0 | ||
unicore.content | ||
unicore.google | ||
unicore.distribute | ||
|
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,17 @@ | ||
from pyramid_celery import celery_app as app | ||
|
||
from elasticgit import EG | ||
from elasticgit.storage import RemoteStorageManager | ||
|
||
from springboard.utils import is_remote_repo_url, parse_repo_name | ||
|
||
|
||
@app.task(ignore_result=True) | ||
def pull(repo_url, index_prefix=None, es=None): | ||
if is_remote_repo_url(repo_url): | ||
sm = RemoteStorageManager(repo_url) | ||
sm.pull() | ||
else: | ||
index_prefix = index_prefix or parse_repo_name(repo_url) | ||
workspace = EG.workspace(repo_url, index_prefix=index_prefix, es=es) | ||
workspace.pull() |
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
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,43 @@ | ||
from pyramid import testing | ||
|
||
from mock import patch | ||
|
||
from springboard.tests.base import SpringboardTestCase | ||
from springboard.tasks import pull | ||
from springboard.utils import repo_url | ||
|
||
|
||
class TestTasks(SpringboardTestCase): | ||
|
||
def setUp(self): | ||
self.config = testing.setUp() | ||
celery_config = self.mk_configfile({ | ||
'celery': { | ||
'celery_always_eager': 'true'} | ||
}) | ||
self.config.include('pyramid_celery') | ||
self.config.configure_celery(celery_config) | ||
|
||
def tearDown(self): | ||
testing.tearDown() | ||
|
||
@patch('springboard.tasks.RemoteStorageManager') | ||
@patch('springboard.tasks.EG.workspace') | ||
def test_pull(self, mocked_workspace, mocked_rsm): | ||
local_repo_url = repo_url('repos', 'foo') | ||
remote_repo_url = repo_url('repos', 'http://localhost/repos/foo.json') | ||
es = {'urls': ['http://host:port']} | ||
|
||
pull.delay(local_repo_url, index_prefix='foo', es=es) | ||
mocked_workspace.assert_called_once_with( | ||
local_repo_url, | ||
index_prefix='foo', | ||
es=es) | ||
mocked_workspace.pull.assert_called_once() | ||
mocked_rsm.assert_not_called() | ||
|
||
mocked_workspace.reset_mock() | ||
pull.delay(remote_repo_url, index_prefix='foo', es=es) | ||
mocked_rsm.assert_called_once_with(remote_repo_url) | ||
mocked_rsm.pull.assert_called_once() | ||
mocked_workspace.assert_not_called() |
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
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
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
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.