-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from saritasa-nest/feature/improve-coverage
Add tests for views and actions
- Loading branch information
Showing
5 changed files
with
291 additions
and
14 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
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
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,32 @@ | ||
import sys | ||
|
||
from rest_framework import viewsets | ||
|
||
import pytest | ||
import pytest_mock | ||
|
||
from import_export_extensions.api.views import ( | ||
ExportJobViewSet, | ||
ImportJobViewSet, | ||
) | ||
from test_project.fake_app.resources import SimpleArtistResource | ||
|
||
|
||
@pytest.mark.parametrize( | ||
argnames="viewset_class", | ||
argvalues=[ | ||
ExportJobViewSet, | ||
ImportJobViewSet, | ||
], | ||
) | ||
def test_new_viewset_class( | ||
viewset_class: type[viewsets.GenericViewSet], | ||
mocker: pytest_mock.MockerFixture, | ||
): | ||
"""Check that if drf_spectacular is not set it will not raise an error.""" | ||
mocker.patch.dict(sys.modules, {"drf_spectacular.utils": None}) | ||
|
||
class TestViewSet(viewset_class): | ||
resource_class = SimpleArtistResource | ||
|
||
assert TestViewSet is not None |