diff --git a/ereuse_devicehub/resources/documents/documents.py b/ereuse_devicehub/resources/documents/documents.py index 33eca9b8..cd1d5254 100644 --- a/ereuse_devicehub/resources/documents/documents.py +++ b/ereuse_devicehub/resources/documents/documents.py @@ -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) diff --git a/tests/test_basic.py b/tests/test_basic.py index b5e52805..d3b7e6e2 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -41,6 +41,7 @@ def test_api_docs(client: Client): '/documents/erasures/', '/documents/devices/', '/documents/stamps/', + '/documents/internalstats/', '/documents/stock/', '/documents/check/', '/documents/lots/', diff --git a/tests/test_documents.py b/tests/test_documents.py index fc4f8ea2..358ca869 100644 --- a/tests/test_documents.py +++ b/tests/test_documents.py @@ -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