2018-08-03 16:15:08 +00:00
|
|
|
import ipaddress
|
2018-08-26 17:04:42 +00:00
|
|
|
from datetime import timedelta
|
2018-10-15 09:21:21 +00:00
|
|
|
from decimal import Decimal
|
2018-10-13 12:53:46 +00:00
|
|
|
from typing import Tuple
|
2018-06-10 16:47:49 +00:00
|
|
|
|
2018-04-30 17:58:19 +00:00
|
|
|
import pytest
|
2018-08-03 16:15:08 +00:00
|
|
|
from flask import current_app as app, g
|
2018-07-14 14:41:22 +00:00
|
|
|
from sqlalchemy.util import OrderedSet
|
2018-08-26 17:04:42 +00:00
|
|
|
from teal.enums import Currency, Subdivision
|
2018-07-14 14:41:22 +00:00
|
|
|
|
2018-07-22 20:42:49 +00:00
|
|
|
from ereuse_devicehub.client import UserClient
|
2018-04-30 17:58:19 +00:00
|
|
|
from ereuse_devicehub.db import db
|
2018-11-17 17:24:34 +00:00
|
|
|
from ereuse_devicehub.resources import enums
|
2019-05-11 14:27:22 +00:00
|
|
|
from ereuse_devicehub.resources.action import models
|
2018-10-13 12:53:46 +00:00
|
|
|
from ereuse_devicehub.resources.device import states
|
2018-07-14 14:41:22 +00:00
|
|
|
from ereuse_devicehub.resources.device.models import Desktop, Device, GraphicCard, HardDrive, \
|
2018-06-16 10:41:12 +00:00
|
|
|
RamModule, SolidStateDrive
|
2018-11-08 16:37:14 +00:00
|
|
|
from ereuse_devicehub.resources.enums import ComputerChassis, Severity, TestDataStorageLength
|
2018-08-03 16:15:08 +00:00
|
|
|
from tests import conftest
|
2018-07-22 20:42:49 +00:00
|
|
|
from tests.conftest import create_user, file
|
2018-04-30 17:58:19 +00:00
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
@pytest.mark.usefixtures(conftest.app_context.__name__)
|
2018-04-30 17:58:19 +00:00
|
|
|
def test_author():
|
|
|
|
"""
|
|
|
|
Checks the default created author.
|
|
|
|
|
|
|
|
Note that the author can be accessed after inserting the row.
|
|
|
|
"""
|
|
|
|
user = create_user()
|
|
|
|
g.user = user
|
2019-05-11 14:27:22 +00:00
|
|
|
e = models.ActionWithOneDevice(device=Device())
|
2018-04-30 17:58:19 +00:00
|
|
|
db.session.add(e)
|
|
|
|
assert e.author is None
|
|
|
|
assert e.author_id is None
|
|
|
|
db.session.commit()
|
|
|
|
assert e.author == user
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
2018-06-10 16:47:49 +00:00
|
|
|
def test_erase_basic():
|
2018-07-22 20:42:49 +00:00
|
|
|
erasure = models.EraseBasic(
|
2018-06-10 16:47:49 +00:00
|
|
|
device=HardDrive(serial_number='foo', manufacturer='bar', model='foo-bar'),
|
2018-11-17 17:24:34 +00:00
|
|
|
steps=[
|
|
|
|
models.StepZero(**conftest.T),
|
|
|
|
models.StepRandom(**conftest.T)
|
|
|
|
],
|
2018-08-26 17:04:42 +00:00
|
|
|
**conftest.T
|
2018-06-10 16:47:49 +00:00
|
|
|
)
|
|
|
|
db.session.add(erasure)
|
|
|
|
db.session.commit()
|
2018-07-22 20:42:49 +00:00
|
|
|
db_erasure = models.EraseBasic.query.one()
|
2018-06-10 16:47:49 +00:00
|
|
|
assert erasure == db_erasure
|
2019-05-11 14:27:22 +00:00
|
|
|
assert next(iter(db_erasure.device.actions)) == erasure
|
2018-11-17 17:24:34 +00:00
|
|
|
assert not erasure.standards, 'EraseBasic themselves do not have standards'
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
2018-06-10 16:47:49 +00:00
|
|
|
def test_validate_device_data_storage():
|
2019-05-11 14:27:22 +00:00
|
|
|
"""Checks the validation for data-storage-only actions works."""
|
2018-06-10 16:47:49 +00:00
|
|
|
# We can't set a GraphicCard
|
|
|
|
with pytest.raises(TypeError,
|
|
|
|
message='EraseBasic.device must be a DataStorage '
|
|
|
|
'but you passed <GraphicCard None model=\'foo-bar\' S/N=\'foo\'>'):
|
2018-07-22 20:42:49 +00:00
|
|
|
models.EraseBasic(
|
2018-06-10 16:47:49 +00:00
|
|
|
device=GraphicCard(serial_number='foo', manufacturer='bar', model='foo-bar'),
|
|
|
|
clean_with_zeros=True,
|
2018-08-26 17:04:42 +00:00
|
|
|
**conftest.T
|
2018-06-10 16:47:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
2018-11-17 17:24:34 +00:00
|
|
|
def test_erase_sectors_steps_erasure_standards_hmg_is5():
|
2018-07-22 20:42:49 +00:00
|
|
|
erasure = models.EraseSectors(
|
2018-06-10 16:47:49 +00:00
|
|
|
device=SolidStateDrive(serial_number='foo', manufacturer='bar', model='foo-bar'),
|
|
|
|
steps=[
|
2018-08-26 17:04:42 +00:00
|
|
|
models.StepZero(**conftest.T),
|
|
|
|
models.StepRandom(**conftest.T),
|
2018-11-17 17:24:34 +00:00
|
|
|
models.StepRandom(**conftest.T)
|
2018-08-26 17:04:42 +00:00
|
|
|
],
|
|
|
|
**conftest.T
|
2018-06-10 16:47:49 +00:00
|
|
|
)
|
|
|
|
db.session.add(erasure)
|
|
|
|
db.session.commit()
|
2018-07-22 20:42:49 +00:00
|
|
|
db_erasure = models.EraseSectors.query.one()
|
2018-06-10 16:47:49 +00:00
|
|
|
# Steps are in order
|
|
|
|
assert db_erasure.steps[0].num == 0
|
|
|
|
assert db_erasure.steps[1].num == 1
|
|
|
|
assert db_erasure.steps[2].num == 2
|
2018-11-17 17:24:34 +00:00
|
|
|
assert {enums.ErasureStandards.HMG_IS5} == erasure.standards
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
2018-11-09 10:22:13 +00:00
|
|
|
def test_test_data_storage_working():
|
|
|
|
"""Tests TestDataStorage with the resulting properties in Device."""
|
|
|
|
hdd = HardDrive(serial_number='foo', manufacturer='bar', model='foo-bar')
|
2018-07-22 20:42:49 +00:00
|
|
|
test = models.TestDataStorage(
|
2018-11-09 10:22:13 +00:00
|
|
|
device=hdd,
|
|
|
|
severity=Severity.Error,
|
2018-06-10 16:47:49 +00:00
|
|
|
elapsed=timedelta(minutes=25),
|
2018-10-08 08:37:32 +00:00
|
|
|
length=TestDataStorageLength.Short,
|
2018-11-09 10:22:13 +00:00
|
|
|
status=':-(',
|
2018-06-10 16:47:49 +00:00
|
|
|
lifetime=timedelta(days=120)
|
|
|
|
)
|
|
|
|
db.session.add(test)
|
2018-11-09 10:22:13 +00:00
|
|
|
db.session.flush()
|
|
|
|
assert hdd.working == [test]
|
|
|
|
assert not hdd.problems
|
|
|
|
# Add new test overriding the first test in the problems
|
|
|
|
# / working condition
|
|
|
|
test2 = models.TestDataStorage(
|
|
|
|
device=hdd,
|
|
|
|
severity=Severity.Warning,
|
|
|
|
elapsed=timedelta(minutes=25),
|
|
|
|
length=TestDataStorageLength.Short,
|
|
|
|
status=':-(',
|
|
|
|
lifetime=timedelta(days=120)
|
|
|
|
)
|
|
|
|
db.session.add(test2)
|
|
|
|
db.session.flush()
|
|
|
|
assert hdd.working == [test2]
|
|
|
|
assert hdd.problems == []
|
2018-06-10 16:47:49 +00:00
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
2018-06-10 16:47:49 +00:00
|
|
|
def test_install():
|
|
|
|
hdd = HardDrive(serial_number='sn')
|
2018-07-22 20:42:49 +00:00
|
|
|
install = models.Install(name='LinuxMint 18.04 es',
|
|
|
|
elapsed=timedelta(seconds=25),
|
|
|
|
device=hdd)
|
2018-06-10 16:47:49 +00:00
|
|
|
db.session.add(install)
|
|
|
|
db.session.commit()
|
2018-06-16 10:41:12 +00:00
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
2019-05-11 14:27:22 +00:00
|
|
|
def test_update_components_action_one():
|
2018-10-18 08:09:10 +00:00
|
|
|
computer = Desktop(serial_number='sn1',
|
|
|
|
model='ml1',
|
|
|
|
manufacturer='mr1',
|
|
|
|
chassis=ComputerChassis.Tower)
|
2018-06-16 10:41:12 +00:00
|
|
|
hdd = HardDrive(serial_number='foo', manufacturer='bar', model='foo-bar')
|
|
|
|
computer.components.add(hdd)
|
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
# Add action
|
2019-04-30 00:02:23 +00:00
|
|
|
test = models.StressTest(elapsed=timedelta(minutes=1))
|
2019-05-11 14:27:22 +00:00
|
|
|
computer.actions_one.add(test)
|
2018-06-16 10:41:12 +00:00
|
|
|
assert test.device == computer
|
2019-05-11 14:27:22 +00:00
|
|
|
assert next(iter(test.components)) == hdd, 'Action has to have new components'
|
2018-06-16 10:41:12 +00:00
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
# Remove action
|
|
|
|
computer.actions_one.clear()
|
2018-06-16 10:41:12 +00:00
|
|
|
assert not test.device
|
2019-05-11 14:27:22 +00:00
|
|
|
assert not test.components, 'Action has to loose the components'
|
2018-06-16 10:41:12 +00:00
|
|
|
|
2019-05-11 14:27:22 +00:00
|
|
|
# If we add a component to a device AFTER assigning the action
|
|
|
|
# to the device, the action doesn't get the new component
|
|
|
|
computer.actions_one.add(test)
|
2018-06-16 10:41:12 +00:00
|
|
|
ram = RamModule()
|
|
|
|
computer.components.add(ram)
|
|
|
|
assert len(test.components) == 1
|
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
2019-05-11 14:27:22 +00:00
|
|
|
def test_update_components_action_multiple():
|
2018-10-18 08:09:10 +00:00
|
|
|
computer = Desktop(serial_number='sn1',
|
|
|
|
model='ml1',
|
|
|
|
manufacturer='mr1',
|
|
|
|
chassis=ComputerChassis.Tower)
|
2018-06-16 10:41:12 +00:00
|
|
|
hdd = HardDrive(serial_number='foo', manufacturer='bar', model='foo-bar')
|
|
|
|
computer.components.add(hdd)
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
ready = models.ReadyToUse()
|
2018-06-16 10:41:12 +00:00
|
|
|
assert not ready.devices
|
|
|
|
assert not ready.components
|
|
|
|
|
|
|
|
# Add
|
2019-05-11 14:27:22 +00:00
|
|
|
computer.actions_multiple.add(ready)
|
2018-06-16 10:41:12 +00:00
|
|
|
assert ready.devices == OrderedSet([computer])
|
|
|
|
assert next(iter(ready.components)) == hdd
|
|
|
|
|
|
|
|
# Remove
|
2019-05-11 14:27:22 +00:00
|
|
|
computer.actions_multiple.remove(ready)
|
2018-06-16 10:41:12 +00:00
|
|
|
assert not ready.devices
|
|
|
|
assert not ready.components
|
|
|
|
|
|
|
|
# init / replace collection
|
|
|
|
ready.devices = OrderedSet([computer])
|
|
|
|
assert ready.devices
|
|
|
|
assert ready.components
|
|
|
|
|
|
|
|
|
2018-08-03 16:15:08 +00:00
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
2018-06-16 10:41:12 +00:00
|
|
|
def test_update_parent():
|
2018-10-18 08:09:10 +00:00
|
|
|
computer = Desktop(serial_number='sn1',
|
|
|
|
model='ml1',
|
|
|
|
manufacturer='mr1',
|
|
|
|
chassis=ComputerChassis.Tower)
|
2018-06-16 10:41:12 +00:00
|
|
|
hdd = HardDrive(serial_number='foo', manufacturer='bar', model='foo-bar')
|
|
|
|
computer.components.add(hdd)
|
|
|
|
|
|
|
|
# Add
|
2018-07-22 20:42:49 +00:00
|
|
|
benchmark = models.BenchmarkDataStorage()
|
2018-06-16 10:41:12 +00:00
|
|
|
benchmark.device = hdd
|
|
|
|
assert benchmark.parent == computer
|
|
|
|
assert not benchmark.components
|
|
|
|
|
|
|
|
# Remove
|
|
|
|
benchmark.device = None
|
|
|
|
assert not benchmark.parent
|
2018-07-22 20:42:49 +00:00
|
|
|
|
|
|
|
|
2019-06-29 14:26:14 +00:00
|
|
|
@pytest.mark.parametrize('action_model_state',
|
|
|
|
(pytest.param(ams, id=ams[0].__class__.__name__)
|
|
|
|
for ams in [
|
|
|
|
(models.ToRepair, states.Physical.ToBeRepaired),
|
|
|
|
(models.Repair, states.Physical.Repaired),
|
|
|
|
(models.ToPrepare, states.Physical.Preparing),
|
|
|
|
(models.ReadyToUse, states.Physical.ReadyToBeUsed),
|
|
|
|
(models.Prepare, states.Physical.Prepared)
|
|
|
|
]))
|
2019-05-11 14:27:22 +00:00
|
|
|
def test_generic_action(action_model_state: Tuple[models.Action, states.Trading],
|
|
|
|
user: UserClient):
|
|
|
|
"""Tests POSTing all generic actions."""
|
|
|
|
action_model, state = action_model_state
|
2018-07-22 20:42:49 +00:00
|
|
|
snapshot, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
2019-05-11 14:27:22 +00:00
|
|
|
action = {'type': action_model.t, 'devices': [snapshot['device']['id']]}
|
|
|
|
action, _ = user.post(action, res=models.Action)
|
|
|
|
assert action['devices'][0]['id'] == snapshot['device']['id']
|
2018-07-22 20:42:49 +00:00
|
|
|
device, _ = user.get(res=Device, item=snapshot['device']['id'])
|
2019-05-11 14:27:22 +00:00
|
|
|
assert device['actions'][-1]['id'] == action['id']
|
2018-10-13 12:53:46 +00:00
|
|
|
assert device['physical'] == state.name
|
2018-08-03 16:15:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
|
|
|
def test_live():
|
|
|
|
"""Tests inserting a Live into the database and GETting it."""
|
|
|
|
db_live = models.Live(ip=ipaddress.ip_address('79.147.10.10'),
|
|
|
|
subdivision_confidence=84,
|
|
|
|
subdivision=Subdivision['ES-CA'],
|
2018-09-30 10:29:33 +00:00
|
|
|
city='barcelona',
|
2018-08-03 16:15:08 +00:00
|
|
|
city_confidence=20,
|
2018-09-30 10:29:33 +00:00
|
|
|
isp='acme',
|
2018-08-03 16:15:08 +00:00
|
|
|
device=Desktop(serial_number='sn1', model='ml1', manufacturer='mr1',
|
|
|
|
chassis=ComputerChassis.Docking),
|
2018-09-30 10:29:33 +00:00
|
|
|
organization='acme1',
|
|
|
|
organization_type='acme1bis')
|
2018-08-03 16:15:08 +00:00
|
|
|
db.session.add(db_live)
|
|
|
|
db.session.commit()
|
|
|
|
client = UserClient(app, 'foo@foo.com', 'foo', response_wrapper=app.response_class)
|
|
|
|
client.login()
|
2019-05-11 14:27:22 +00:00
|
|
|
live, _ = client.get(res=models.Action, item=str(db_live.id))
|
2018-08-03 16:15:08 +00:00
|
|
|
assert live['ip'] == '79.147.10.10'
|
|
|
|
assert live['subdivision'] == 'ES-CA'
|
|
|
|
assert live['country'] == 'ES'
|
2018-10-13 12:53:46 +00:00
|
|
|
device, _ = client.get(res=Device, item=live['device']['id'])
|
|
|
|
assert device['physical'] == states.Physical.InUse.name
|
2018-08-03 16:15:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.xfail(reson='Functionality not developed.')
|
|
|
|
def test_live_geoip():
|
|
|
|
"""Tests performing a Live action using the GEOIP library."""
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.xfail(reson='Develop reserve')
|
2018-11-17 16:03:03 +00:00
|
|
|
def test_reserve_and_cancel(user: UserClient):
|
|
|
|
"""Performs a reservation and then cancels it,
|
|
|
|
checking the attribute `reservees`.
|
|
|
|
"""
|
2018-08-03 16:15:08 +00:00
|
|
|
|
|
|
|
|
2019-06-29 14:26:14 +00:00
|
|
|
@pytest.mark.parametrize('action_model_state',
|
|
|
|
(pytest.param(ams, id=ams[0].__class__.__name__)
|
|
|
|
for ams in [
|
|
|
|
(models.Sell, states.Trading.Sold),
|
|
|
|
(models.Donate, states.Trading.Donated),
|
|
|
|
(models.Rent, states.Trading.Renting),
|
|
|
|
(models.DisposeProduct, states.Trading.ProductDisposed)
|
|
|
|
]))
|
2019-05-11 14:27:22 +00:00
|
|
|
def test_trade(action_model_state: Tuple[models.Action, states.Trading], user: UserClient):
|
|
|
|
"""Tests POSTing all Trade actions."""
|
|
|
|
action_model, state = action_model_state
|
2018-08-03 16:15:08 +00:00
|
|
|
snapshot, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
2019-05-11 14:27:22 +00:00
|
|
|
action = {
|
|
|
|
'type': action_model.t,
|
2018-08-03 16:15:08 +00:00
|
|
|
'devices': [snapshot['device']['id']],
|
|
|
|
'to': user.user['individuals'][0]['id'],
|
|
|
|
'shippingDate': '2018-06-29T12:28:54',
|
|
|
|
'invoiceNumber': 'ABC'
|
|
|
|
}
|
2019-05-11 14:27:22 +00:00
|
|
|
action, _ = user.post(action, res=models.Action)
|
|
|
|
assert action['devices'][0]['id'] == snapshot['device']['id']
|
2018-08-03 16:15:08 +00:00
|
|
|
device, _ = user.get(res=Device, item=snapshot['device']['id'])
|
2019-05-11 14:27:22 +00:00
|
|
|
assert device['actions'][-1]['id'] == action['id']
|
2018-10-13 12:53:46 +00:00
|
|
|
assert device['trading'] == state.name
|
2018-08-03 16:15:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.xfail(reson='Develop migrate')
|
|
|
|
def test_migrate():
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
|
|
|
def test_price_custom():
|
|
|
|
computer = Desktop(serial_number='sn1', model='ml1', manufacturer='mr1',
|
|
|
|
chassis=ComputerChassis.Docking)
|
2018-10-15 09:21:21 +00:00
|
|
|
price = models.Price(price=Decimal(25.25), currency=Currency.EUR)
|
2018-08-03 16:15:08 +00:00
|
|
|
price.device = computer
|
2018-10-13 12:53:46 +00:00
|
|
|
assert computer.price == price
|
2018-08-03 16:15:08 +00:00
|
|
|
db.session.add(computer)
|
|
|
|
db.session.commit()
|
|
|
|
|
|
|
|
client = UserClient(app, 'foo@foo.com', 'foo', response_wrapper=app.response_class)
|
|
|
|
client.login()
|
2019-05-11 14:27:22 +00:00
|
|
|
p, _ = client.get(res=models.Action, item=str(price.id))
|
2018-08-03 16:15:08 +00:00
|
|
|
assert p['device']['id'] == price.device.id == computer.id
|
|
|
|
assert p['price'] == 25.25
|
|
|
|
assert p['currency'] == Currency.EUR.name == 'EUR'
|
2018-10-13 12:53:46 +00:00
|
|
|
|
|
|
|
c, _ = client.get(res=Device, item=computer.id)
|
|
|
|
assert c['price']['id'] == p['id']
|
2018-10-15 09:21:21 +00:00
|
|
|
|
|
|
|
|
2018-11-17 18:22:41 +00:00
|
|
|
def test_price_custom_client(user: UserClient):
|
2018-10-16 06:46:55 +00:00
|
|
|
"""As test_price_custom but creating the price through the API."""
|
2018-11-17 18:22:41 +00:00
|
|
|
s = file('basic.snapshot')
|
|
|
|
snapshot, _ = user.post(s, res=models.Snapshot)
|
|
|
|
price, _ = user.post({
|
|
|
|
'type': 'Price',
|
|
|
|
'price': 25,
|
|
|
|
'currency': Currency.EUR.name,
|
|
|
|
'device': snapshot['device']['id']
|
2019-05-11 14:27:22 +00:00
|
|
|
}, res=models.Action)
|
2018-11-17 18:22:41 +00:00
|
|
|
assert 25 == price['price']
|
|
|
|
assert Currency.EUR.name == price['currency']
|
|
|
|
|
|
|
|
device, _ = user.get(res=Device, item=price['device']['id'])
|
|
|
|
assert 25 == device['price']['price']
|
2018-10-16 06:46:55 +00:00
|
|
|
|
|
|
|
|
2018-10-15 09:21:21 +00:00
|
|
|
@pytest.mark.xfail(reson='Develop test')
|
|
|
|
def test_ereuse_price():
|
|
|
|
"""Tests the several ways of creating eReuse Price, emulating
|
|
|
|
from an AggregateRate and ensuring that the different Range
|
|
|
|
return correct results."""
|
|
|
|
# important to check Range.low no returning warranty2
|
|
|
|
# Range.verylow not returning nothing
|
2018-11-15 12:35:19 +00:00
|
|
|
|
|
|
|
|
2018-11-17 17:24:34 +00:00
|
|
|
@pytest.mark.usefixtures(conftest.auth_app_context.__name__)
|
2018-11-15 12:35:19 +00:00
|
|
|
def test_erase_physical():
|
2018-11-17 17:24:34 +00:00
|
|
|
erasure = models.ErasePhysical(
|
|
|
|
device=HardDrive(serial_number='foo', manufacturer='bar', model='foo-bar'),
|
|
|
|
method=enums.PhysicalErasureMethod.Disintegration
|
|
|
|
)
|
|
|
|
db.session.add(erasure)
|
|
|
|
db.session.commit()
|
2018-11-17 16:03:03 +00:00
|
|
|
|
|
|
|
|
2019-05-08 17:12:05 +00:00
|
|
|
@pytest.mark.xfail(reson='develop')
|
|
|
|
def test_measure_battery():
|
|
|
|
"""Tests the MeasureBattery."""
|
|
|
|
# todo jn
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.xfail(reson='develop')
|
|
|
|
def test_test_camera():
|
|
|
|
"""Tests the TestCamera."""
|
|
|
|
# todo jn
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.xfail(reson='develop')
|
|
|
|
def test_test_keyboard():
|
|
|
|
"""Tests the TestKeyboard."""
|
|
|
|
# todo jn
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.xfail(reson='develop')
|
|
|
|
def test_test_trackpad():
|
|
|
|
"""Tests the TestTrackpad."""
|
|
|
|
# todo jn
|