-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `get_all_download_formats` will try to call `get_export_formats` on all the known plugin types. However, it is not guaranteed that all plugins implement this method. This was properly considered in the case that `full_type` is not None, however, in the other case the `AttributeError` was not being caught causing the REST API to except.
- Loading branch information
Showing
2 changed files
with
22 additions
and
10 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
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,15 @@ | ||
"""Tests for the `aiida.restapi.translator` module.""" | ||
# pylint: disable=invalid-name | ||
from aiida.restapi.translator.nodes.node import NodeTranslator | ||
from aiida.orm import Data | ||
|
||
|
||
def test_get_all_download_formats(): | ||
"""Test the `get_all_download_formats` method.""" | ||
NodeTranslator.get_all_download_formats() | ||
|
||
|
||
def test_get_all_download_formats_missing_get_export_formats(monkeypatch): | ||
"""Test `get_all_download_formats` does not except if a `Data` class does not implement `get_export_formats`.""" | ||
monkeypatch.delattr(Data, 'get_export_formats') | ||
NodeTranslator.get_all_download_formats() |