-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server: Added changelog for views - fix #65 !!! TEMP !!!
- Loading branch information
1 parent
ea13824
commit 4f2a48e
Showing
8 changed files
with
154 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.. StoreKeeper documentation | ||
Changelog | ||
========= | ||
|
||
API endpoint for changelog. | ||
|
||
Data management | ||
--------------- | ||
|
||
``/api/changelog`` | ||
^^^^^^^^^^^^^^^^^^ | ||
.. autoflask:: app.server:app | ||
:endpoints: changelog_list | ||
|
||
``/api/changelog/<str:model>`` | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
.. autoflask:: app.server:app | ||
:endpoints: changelog_model_list | ||
|
||
``/api/changelog/<str:model>/<int:id>`` | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
.. autoflask:: app.server:app | ||
:endpoints: changelog_model_object_list |
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 |
---|---|---|
|
@@ -21,6 +21,7 @@ Endpoints | |
|
||
acquisitions | ||
barcodes | ||
changelog | ||
config | ||
customers | ||
error | ||
|
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,38 @@ | ||
from app.models import Changelog | ||
from app.views.base_views import BaseListView | ||
from app.modules.example_data import ExampleChangeLogs | ||
from app.serializers import ChangelogSerializer | ||
from app.views.common import api_func | ||
|
||
|
||
class ChangelogListView(BaseListView): | ||
_model = Changelog | ||
_serializer = ChangelogSerializer() | ||
|
||
@api_func('Show global changelog', url_tail='/changelog', | ||
response=[ExampleChangeLogs.LOG1_ADMIN_POST_USER1.get(), | ||
ExampleChangeLogs.LOG2_USER1_POST_VENDOR1.get()]) | ||
def get(self): | ||
return None | ||
|
||
|
||
class ChangelogModelListView(BaseListView): | ||
_model = Changelog | ||
_serializer = ChangelogSerializer() | ||
|
||
@api_func('Show changelog of users', url_tail='/changelog/user', | ||
response=[ExampleChangeLogs.LOG1_ADMIN_POST_USER1.get(), | ||
ExampleChangeLogs.LOG2_USER1_POST_VENDOR1.get()]) | ||
def get(self): | ||
return None | ||
|
||
|
||
class ChangelogModelObjectListView(BaseListView): | ||
_model = Changelog | ||
_serializer = ChangelogSerializer() | ||
|
||
@api_func('Show changelog of user#2', url_tail='/changelog/user/2', | ||
response=[ExampleChangeLogs.LOG1_ADMIN_POST_USER1.get(), | ||
ExampleChangeLogs.LOG2_USER1_POST_VENDOR1.get()]) | ||
def get(self): | ||
return None |
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,18 @@ | ||
from app.modules.example_data import ExampleVendors as Vendors, ExampleUsers as Users, ExampleChangeLogs as Logs | ||
from test.e2e.base_session_test import CommonSessionTest | ||
|
||
|
||
class TestChangelog(CommonSessionTest): | ||
ENDPOINT = '/changelog' | ||
INIT_PUSH = [ | ||
('/users', [Users.USER1]), | ||
] | ||
|
||
def setUp(self): | ||
super().setUp() | ||
self.assertApiLogin(credential=Users.USER1) | ||
self.assertApiPost(endpoint='/vendors', data=Vendors.VENDOR1.set()) | ||
|
||
def test_list_changelog(self): | ||
self.assertApiGet(expected_data=[Logs.LOG1_ADMIN_POST_USER1, | ||
Logs.LOG2_USER1_POST_VENDOR1]) |