-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* removed unnecessary code
- Loading branch information
Showing
20 changed files
with
110 additions
and
142 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,5 @@ coverage.xml | |
.pytest_cache/ | ||
.DS_Store | ||
*.sqlite3 | ||
/tests/test_server/test_app/migrations/ | ||
notes |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,35 +0,0 @@ | ||
import pytest | ||
|
||
from drf_api_action.utils import run_as_api | ||
from drf_api_action.exceptions import ActionsAPIException | ||
from drf_api_action.mixins import APIRestMixin | ||
|
||
|
||
def run_function(self, func): | ||
def api_item(*args, **kwargs): | ||
serializer_class = func.kwargs['serializer_class'] | ||
return run_as_api(self, func, serializer_class, *args, **kwargs) | ||
return api_item | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def action_api(request): | ||
""" | ||
Make Dango WebView endpoints accessible | ||
""" | ||
if request.keywords['action_api'].kwargs.get("view_set_class") is None: | ||
raise ActionsAPIException('using action_api fixture must require a view_set_class kwarg') | ||
|
||
view_set_class = request.keywords['action_api'].kwargs["view_set_class"] | ||
|
||
class WrapperApiClass(APIRestMixin, view_set_class): | ||
def __getattribute__(self, item): | ||
class_attribute = super().__getattribute__(item) | ||
|
||
if callable(class_attribute) and hasattr(class_attribute, 'detail'): | ||
return run_function(self, class_attribute) | ||
|
||
return class_attribute | ||
|
||
api = WrapperApiClass() | ||
return api | ||
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,37 @@ | ||
import pytest | ||
|
||
from drf_api_action.utils import run_as_api | ||
from drf_api_action.exceptions import ActionsAPIException | ||
|
||
|
||
def run_function(self, func): | ||
def api_item(*args, **kwargs): | ||
serializer_class = func.kwargs['serializer_class'] | ||
return run_as_api(self, func, serializer_class, *args, **kwargs) | ||
|
||
return api_item | ||
|
||
|
||
@pytest.fixture | ||
def action_api(request): | ||
""" | ||
Make Dango WebView endpoints accessible | ||
""" | ||
from drf_api_action.mixins import APIRestMixin | ||
|
||
if request.keywords['action_api'].kwargs.get("view_set_class") is None: | ||
raise ActionsAPIException('using action_api fixture must require a view_set_class kwarg') | ||
|
||
view_set_class = request.keywords['action_api'].kwargs["view_set_class"] | ||
|
||
class WrapperApiClass(APIRestMixin, view_set_class): | ||
def __getattribute__(self, item): | ||
class_attribute = super().__getattribute__(item) | ||
|
||
if callable(class_attribute) and hasattr(class_attribute, 'detail'): | ||
return run_function(self, class_attribute) | ||
|
||
return class_attribute | ||
|
||
api = WrapperApiClass() | ||
return api |
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 was deleted.
Oops, something went wrong.
Binary file not shown.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Empty file.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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