basic endpoint for internal stats
This commit is contained in:
parent
39fcbd24b7
commit
ce4dce055d
|
@ -252,6 +252,13 @@ class StampsView(View):
|
|||
return flask.render_template('documents/stamp.html', rq_url=url_path)
|
||||
|
||||
|
||||
class InternalStatsView(View):
|
||||
|
||||
def get(self):
|
||||
result = ''
|
||||
return jsonify(result)
|
||||
|
||||
|
||||
class DocumentDef(Resource):
|
||||
__type__ = 'Document'
|
||||
SCHEMA = None
|
||||
|
@ -307,6 +314,9 @@ class DocumentDef(Resource):
|
|||
stamps_view = StampsView.as_view('StampsView', definition=self, auth=app.auth)
|
||||
self.add_url_rule('/stamps/', defaults={}, view_func=stamps_view, methods=get)
|
||||
|
||||
stamps_view = InternalStatsView.as_view('InternalStatsView', definition=self, auth=app.auth)
|
||||
self.add_url_rule('/internalstats/', defaults={}, view_func=stamps_view, methods=get)
|
||||
|
||||
actions_view = ActionsDocumentView.as_view('ActionsDocumentView',
|
||||
definition=self,
|
||||
auth=app.auth)
|
||||
|
|
|
@ -41,6 +41,7 @@ def test_api_docs(client: Client):
|
|||
'/documents/erasures/',
|
||||
'/documents/devices/',
|
||||
'/documents/stamps/',
|
||||
'/documents/internalstats/',
|
||||
'/documents/stock/',
|
||||
'/documents/check/',
|
||||
'/documents/lots/',
|
||||
|
|
|
@ -459,3 +459,18 @@ def test_get_document_lots(user: UserClient, user2: UserClient):
|
|||
assert export_csv[1][3] == 'comments,lot1,testcomment-lot1,' or 'comments,lot2,testcomment-lot2,'
|
||||
assert export2_csv[1][1] == 'Lot3-User2'
|
||||
assert export2_csv[1][3] == 'comments,lot3,testcomment-lot3,'
|
||||
|
||||
|
||||
@pytest.mark.mvp
|
||||
def test_get_document_internal_stats(user: UserClient):
|
||||
"""Tests for get teh internal stats."""
|
||||
|
||||
# import pdb; pdb.set_trace()
|
||||
csv_str, _ = user.get(res=documents.DocumentDef.t,
|
||||
item='internalstats/')
|
||||
|
||||
f = StringIO(csv_str)
|
||||
obj_csv = csv.reader(f, f)
|
||||
export_csv = list(obj_csv)
|
||||
|
||||
assert len(export_csv) == 0
|
||||
|
|
Reference in New Issue