clean old code as documents

This commit is contained in:
Cayo Puigdefabregas 2021-09-06 12:44:57 +02:00
parent 0d73bb1f63
commit f398c50288
3 changed files with 0 additions and 70 deletions

View file

@ -33,8 +33,6 @@ from ereuse_devicehub.resources.documents.device_row import (DeviceRow, StockRow
from ereuse_devicehub.resources.lot import LotView
from ereuse_devicehub.resources.lot.models import Lot
from ereuse_devicehub.resources.hash_reports import insert_hash, ReportHash, verify_hash
# from ereuse_devicehub.resources.documents.models import RecycleDocument
# from ereuse_devicehub.resources.documents.schemas import RecycleDocument as sh_document
class Format(enum.Enum):
@ -291,26 +289,6 @@ class StampsView(View):
result=result)
# class RecycleDocumentView(View):
# """
# This view allow save one document as a proof of one container with some weight was send to recycling.
# """
# def post(self):
# # import pdb; pdb.set_trace()
# data = request.get_data()
# schema = sh_document()
# doc = schema.loads(data)
# document = RecycleDocument(**doc)
# db.session.add(document)
# db.session().final_flush()
# ret = jsonify(document)
# ret.status_code = 201
# db.session.commit()
# return ret
class InternalStatsView(DeviceView):
@cache(datetime.timedelta(minutes=1))
def find(self, args: dict):
@ -457,5 +435,3 @@ class DocumentDef(Resource):
wbconf_view = app.auth.requires_auth(wbconf_view)
self.add_url_rule('/wbconf/<string:wbtype>', view_func=wbconf_view, methods=get)
# recycle_doc_view = RecycleDocumentView.as_view('RecycleDocumentView', definition=self, auth=app.auth)
# self.add_url_rule('/recycle/', defaults={}, view_func=recycle_doc_view, methods={'POST'})

View file

@ -33,23 +33,3 @@ class DataWipeDocument(Thing):
@post_load
def get_trade_document(self, data):
data['document_type'] = 'DataWipeDocument'
# class RecycleDocument(Thing):
# __doc__ = m.RecycleDocument.__doc__
# file_hash = SanitizedStr(data_key='hash',
# default='',
# description=m.RecycleDocument.file_hash.comment,
# validate=validate.Length(max=64))
# weight = Float(required=False, validate=Range(0.1), description=m.RecycleDocument.weight.comment)
# lot = NestedOn('Lot', only_query='id', description=m.RecycleDocument.lot.__doc__)
# @post_load
# def get_trade_document(self, data):
# tradedocument = TradeDocument.query.filter_by(file_hash=data['file_hash']).one()
# data['trade_document_id'] = tradedocument.id
# data['file_name'] = tradedocument.file_name
# data['date'] = tradedocument.date
# data['id_document'] = tradedocument.id_document
# data['url'] = tradedocument.url
# data['document_type'] = 'RecycleDocument'

View file

@ -716,29 +716,3 @@ def test_trade_documents_with_weight(user: UserClient):
}
doc, _ = user.post(res=TradeDocument, data=request_post)
assert doc['weight'] == request_post['weight']
# @pytest.mark.mvp
# @pytest.mark.usefixtures(conftest.app_context.__name__)
# def test_recycle_document(user: UserClient):
# """Tests upload one document"""
# lotIn, _ = user.post({'name': 'MyLotIn'}, res=Lot)
# lotOut, _ = user.post({'name': 'MyLotOut'}, res=Lot)
# url = 'http://www.ereuse.org/apapaapaapaapaapaapaapaapaapaapapaapaapaapaapaapaapaapaapaapapaapaapaapaapaapaapaapaapaapaaaa',
# request_post = {
# 'filename': 'test.pdf',
# 'hash': 'bbbbbbbb',
# 'url': url,
# 'weight': 15,
# 'lot': lotOut['id']
# }
# tradedocument, _ = user.post(res=TradeDocument, data=request_post)
# # import pdb; pdb.set_trace()
# request_post2 = {
# 'weight': 15,
# 'hash': tradedocument['hash'],
# 'lot': lotIn['id']
# }
# doc, _ = user.post(res=documents.DocumentDef.t, item='recycle/', data=request_post2)
# assert doc == request_post['filename']