Skip to content

Workspace Broker testing

Jonathan Meyer edited this page Jan 30, 2017 · 2 revisions

I need to throw together a workspace real quick to test list_files capability. I can do that with these lines of python code from the REPL:

from storage.test.utils import create_workspace
from datetime import datetime
json_config = {'version':'1.0','broker':{'type':'host','host_path':'/home/ubuntu/test'}}
workspace = create_workspace(name=datetime.utcnow().isoformat(), json_config=json_config)
from storage.test.utils import create_workspace
from datetime import datetime
json_config = {'version':'1.0','broker':{'type':'host','host_path':'/home/ubuntu/workspace/scale'}}
workspace = create_workspace(name=datetime.utcnow().isoformat(), json_config=json_config)
import django
from mock import patch
from storage.models import Workspace

django.setup()
workspace = Workspace.objects.get(pk=3)
with patch.object(Workspace, '_get_volume_path', return_value='/home/workspace/scale') as mock_method:
    workspace.list_files(True, None)
Clone this wiki locally