def test_workspace_create_no_id():

    workspace = json.loads(read_fixture('workspace.json'))
    workspace.pop('id')
    expected = clone(workspace)
    _set_workspace(workspace)
    client.set_workspace.assert_called_once_with(expected, None)
def test_workspace_create_no_id():

    workspace = json.loads(read_fixture('workspace.json'))
    workspace.pop('id')
    expected = clone(workspace)
    _set_workspace(workspace)
    client.set_workspace.assert_called_once_with(expected, None)
def test_workspace_set_create(client):
    with requests_mock.Mocker() as m:
        uri = os.path.join(client.base_url, "workspaces/")
        workspace = json.loads(read_fixture("workspace.json"))
        request = clone(workspace)
        request.pop("id")
        m.post(uri, text=json.dumps(workspace), status_code=200)
        assert client.set_workspace(request).get_raw() == json.dumps(workspace)
def test_workspace_set_create(client):
    with requests_mock.Mocker() as m:
        uri = os.path.join(client.base_url, 'workspaces/')
        workspace = json.loads(read_fixture('workspace.json'))
        request = clone(workspace)
        request.pop('id')
        m.post(uri, text=json.dumps(workspace), status_code=200)
        assert client.set_workspace(request).get_raw() == json.dumps(workspace)
def test_workspace_update_stdin():
    workspace = json.loads(read_fixture('workspace.json'))
    expected = clone(workspace)
    _set_workspace(workspace)
    client.set_workspace.assert_called_once_with(expected, workspace['id'])
def test_workspace_update_from_existing_with_id():

    workspace = json.loads(read_fixture('workspace.json'))
    expected = clone(workspace)
    _set_workspace(workspace, '--id', '12345')
    client.set_workspace.assert_called_once_with(expected, '12345')
def test_workspace_create_from_existing():

    workspace = json.loads(read_fixture('workspace.json'))
    expected = clone(workspace)
    _set_workspace(workspace, '--create')
    client.set_workspace.assert_called_once_with(expected, None)
def test_workspace_update_stdin():
    workspace = json.loads(read_fixture('workspace.json'))
    expected = clone(workspace)
    _set_workspace(workspace)
    client.set_workspace.assert_called_once_with(expected, workspace['id'])
def test_workspace_update_from_existing_with_id():

    workspace = json.loads(read_fixture('workspace.json'))
    expected = clone(workspace)
    _set_workspace(workspace, '--id', '12345')
    client.set_workspace.assert_called_once_with(expected, '12345')
def test_workspace_create_from_existing():

    workspace = json.loads(read_fixture('workspace.json'))
    expected = clone(workspace)
    _set_workspace(workspace, '--create')
    client.set_workspace.assert_called_once_with(expected, None)