Apply suggestions from code review of branch image-capture
Co-authored-by: Joe Knapper <joe.knapper@glasgow.ac.uk>
This commit is contained in:
parent
58dd3f2afe
commit
d31d1154cc
4 changed files with 6 additions and 3 deletions
|
|
@ -360,7 +360,7 @@ class BaseCamera(OFMThing, ABC):
|
||||||
try:
|
try:
|
||||||
os.remove(full_path)
|
os.remove(full_path)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
self.logger.warning(f"Camera has no image named {name}.")
|
self.logger.warning(f"Failed to delete {name}.")
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
400, "Couldn't delete capture, check log for details"
|
400, "Couldn't delete capture, check log for details"
|
||||||
) from e
|
) from e
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ GALLERY_DELETE_TEST_CASES = [
|
||||||
|
|
||||||
@pytest.mark.parametrize("test_case", GALLERY_DELETE_TEST_CASES)
|
@pytest.mark.parametrize("test_case", GALLERY_DELETE_TEST_CASES)
|
||||||
def test_gallery_calls_delete(test_case, minimal_gallery_env, mocker):
|
def test_gallery_calls_delete(test_case, minimal_gallery_env, mocker):
|
||||||
"""Test that the gallery delete on all gallery providing things.."""
|
"""Test that the gallery deletes on all gallery providing things."""
|
||||||
# Create a config with the minimal Thing and the bad Thing
|
# Create a config with the minimal Thing and the bad Thing
|
||||||
gallery = minimal_gallery_env.get_thing_by_name("gallery")
|
gallery = minimal_gallery_env.get_thing_by_name("gallery")
|
||||||
thing_1 = minimal_gallery_env.get_thing_by_name("minimal_thing1")
|
thing_1 = minimal_gallery_env.get_thing_by_name("minimal_thing1")
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ def test_delete_all_scans(entered_smart_scan_thing, caplog, mocker):
|
||||||
for fake_scan_name in fake_scan_names:
|
for fake_scan_name in fake_scan_names:
|
||||||
fake_scan_path = os.path.join(SCAN_DIR, fake_scan_name)
|
fake_scan_path = os.path.join(SCAN_DIR, fake_scan_name)
|
||||||
assert not os.path.exists(fake_scan_path)
|
assert not os.path.exists(fake_scan_path)
|
||||||
# No One log generated per scan deleted
|
# One log generated per scan deleted
|
||||||
assert len(caplog.records) == 4
|
assert len(caplog.records) == 4
|
||||||
for record in caplog.records:
|
for record in caplog.records:
|
||||||
assert record.message.startswith("Deleting: fake_scan_000")
|
assert record.message.startswith("Deleting: fake_scan_000")
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,9 @@ export default {
|
||||||
}
|
}
|
||||||
return `${this.baseUri}/data/${this.itemData.thing}/${this.itemData.name}`;
|
return `${this.baseUri}/data/${this.itemData.thing}/${this.itemData.name}`;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Return True if there is a viewer available for this card's data.
|
||||||
|
*/
|
||||||
viewerAvailable() {
|
viewerAvailable() {
|
||||||
if (this.itemData.card_type === "Scan") return Boolean(this.itemData?.dzi);
|
if (this.itemData.card_type === "Scan") return Boolean(this.itemData?.dzi);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue