simple test of deliverynote
This commit is contained in:
parent
a0546e284e
commit
761e70b5e6
10
tests/files/devices_deliverynote.csv
Normal file
10
tests/files/devices_deliverynote.csv
Normal 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
|
|
38
tests/test_deliverynote.py
Normal file
38
tests/test_deliverynote.py
Normal 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
|
Reference in a new issue