Skip to content

Commit

Permalink
fix: don't assume upload has all data
Browse files Browse the repository at this point in the history
  • Loading branch information
Xarthisius committed Oct 27, 2023
1 parent 40aae22 commit f48bff7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 22 deletions.
4 changes: 2 additions & 2 deletions virtual_resources/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def wrapper(self, event):

if "uploadId" in params:
upload = Upload().load(params["uploadId"])
parent_id = str(upload["parentId"])
parent_type = upload["parentType"]
parent_id = str(upload.get("parentId"))
parent_type = upload.get("parentType") or "folder"
else:
parent_id = params.get("parentId")
parent_type = params.get("parentType") or "folder"
Expand Down
8 changes: 0 additions & 8 deletions virtual_resources/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# -*- coding: utf-8 -*-

import pathlib
import random
import string

from girder.exceptions import ValidationException

Expand All @@ -15,12 +13,6 @@
chunk1, chunk2 = ("hello ", "world")


def random_string(length=10):
"""Generate a random string of fixed length."""
letters = string.ascii_lowercase
return "".join(random.choice(letters) for i in range(length))


def test_vo_methods(mapped_folder):
from virtual_resources.rest import VirtualObject

Expand Down
13 changes: 1 addition & 12 deletions virtual_resources/tests/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@

import os
import pathlib
import random
import shutil
import string


import pytest
from girder.models.assetstore import Assetstore
from girder.models.setting import Setting
from girder.settings import SettingKey

import pytest

from pytest_girder.assertions import assertStatus, assertStatusOk
from pytest_girder.utils import getResponseBody

Expand All @@ -22,12 +17,6 @@
chunk1, chunk2 = ("hello ", "world")


def random_string(length=10):
"""Generate a random string of fixed length."""
letters = string.ascii_lowercase
return "".join(random.choice(letters) for i in range(length))


@pytest.mark.plugin("virtual_resources")
def test_basic_file_ops(server, user, extra_user, example_mapped_folder):
mapped_folder = example_mapped_folder["girder_root"]
Expand Down

0 comments on commit f48bff7

Please sign in to comment.