simple test of deliverynote

This commit is contained in:
Cayo Puigdefabregas 2021-02-04 20:43:57 +01:00
parent a0546e284e
commit 761e70b5e6
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,10 @@
Box;;Nº Inventary;Type of device;Sub Type;Brand;Model;serial number
;;N006536;PC;;Acer;Veriton M480G;PSV75EZ0070170002C14j00
;;N006549;PC ;;Acer;Veriton M480G;PSV75EZ0070170003714j00
;;N006541;PC ;;Acer;Veriton M480G;
;;N006556;PC;;Acer;Veriton M480G;PSV75EZ0070170001D14j00
;;N006538;PC;;Acer;Veriton M480G;
;;N007465;PC;;Acer;Veriton M480G;PSV75EZ0070170003A14j00
;;;PC;;Acer;Veriton M480G;PSV75EZ007017000361800
;;N006537;PC;;Acer;Veriton M480G;PSV75EZ0070170002214j00
;;N006530;PC;;Acer;Veriton M480G;PSV75EZ0070170000314j00
1 Box Nº Inventary Type of device Sub Type Brand Model serial number
2 N006536 PC Acer Veriton M480G PSV75EZ0070170002C14j00
3 N006549 PC Acer Veriton M480G PSV75EZ0070170003714j00
4 N006541 PC Acer Veriton M480G
5 N006556 PC Acer Veriton M480G PSV75EZ0070170001D14j00
6 N006538 PC Acer Veriton M480G
7 N007465 PC Acer Veriton M480G PSV75EZ0070170003A14j00
8 PC Acer Veriton M480G PSV75EZ007017000361800
9 N006537 PC Acer Veriton M480G PSV75EZ0070170002214j00
10 N006530 PC Acer Veriton M480G PSV75EZ0070170000314j00

View File

@ -0,0 +1,38 @@
import os
import ipaddress
import json
import shutil
import copy
import pytest
from datetime import datetime
from dateutil.tz import tzutc
from ereuse_devicehub.client import UserClient
from ereuse_devicehub.devicehub import Devicehub
from ereuse_devicehub.resources.deliverynote.models import Deliverynote
from tests import conftest
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_simple_deliverynote(user: UserClient, app: Devicehub):
"""
This test create only one deliverinote with the expected Devices
"""
inventory = [{'n_inventory': 'N006536',
'type': 'PC',
'brand': 'Acer',
'model': 'Veriton M480G',
'serial_number': 'PSV75EZ0070170002C14j00'
}]
note = {'date': datetime(2020, 2, 14, 23, 0, tzinfo=tzutc()),
'documentID': 'DocBBE001',
'deposit': 0,
'transfer_state': "Initial",
'expectedDevices': inventory,
'supplierEmail': user.user['email']}
deliverynote, _ = user.post(note, res=Deliverynote)
db_note = Deliverynote.query.filter_by(id=deliverynote['id']).one()
assert deliverynote['documentID'] == note['documentID']
assert user.user['email'] in db_note.lot.name