ading finalUserCode to allocate action
This commit is contained in:
parent
4a217634c7
commit
92c403579b
|
@ -30,6 +30,8 @@ def upgrade():
|
||||||
# Allocate action
|
# Allocate action
|
||||||
op.drop_table('allocate', schema=f'{get_inv()}')
|
op.drop_table('allocate', schema=f'{get_inv()}')
|
||||||
op.create_table('allocate',
|
op.create_table('allocate',
|
||||||
|
sa.Column('final_user_code', citext.CIText(), default='', nullable=True,
|
||||||
|
comment = "This is a internal code for mainteing the secrets of the personal datas of the new holder")
|
||||||
sa.Column('transaction', citext.CIText(), nullable=True, comment='The code used from the owner for relation with external tool.'),
|
sa.Column('transaction', citext.CIText(), nullable=True, comment='The code used from the owner for relation with external tool.'),
|
||||||
sa.Column('end_users', sa.Numeric(precision=4), nullable=True),
|
sa.Column('end_users', sa.Numeric(precision=4), nullable=True),
|
||||||
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
|
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
|
||||||
|
|
|
@ -313,6 +313,9 @@ class Remove(ActionWithOneDevice):
|
||||||
class Allocate(JoinedTableMixin, ActionWithMultipleDevices):
|
class Allocate(JoinedTableMixin, ActionWithMultipleDevices):
|
||||||
"""The act of allocate one list of devices to one person
|
"""The act of allocate one list of devices to one person
|
||||||
"""
|
"""
|
||||||
|
final_user_code = Column(CIText(), default='', nullable=True)
|
||||||
|
final_user_code.comment = """This is a internal code for mainteing the secrets of the
|
||||||
|
personal datas of the new holder"""
|
||||||
transaction = Column(CIText(), default='', nullable=True)
|
transaction = Column(CIText(), default='', nullable=True)
|
||||||
transaction.comment = "The code used from the owner for relation with external tool."
|
transaction.comment = "The code used from the owner for relation with external tool."
|
||||||
end_users = Column(Numeric(precision=4), check_range('end_users', 0), nullable=True)
|
end_users = Column(Numeric(precision=4), check_range('end_users', 0), nullable=True)
|
||||||
|
|
|
@ -71,6 +71,11 @@ class Allocate(ActionWithMultipleDevices):
|
||||||
description=m.Action.start_time.comment)
|
description=m.Action.start_time.comment)
|
||||||
end_time = DateTime(data_key='endTime', required=False,
|
end_time = DateTime(data_key='endTime', required=False,
|
||||||
description=m.Action.end_time.comment)
|
description=m.Action.end_time.comment)
|
||||||
|
final_user_code = SanitizedStr(data_key="finalUserCode"
|
||||||
|
validate=Length(min=1, max=STR_BIG_SIZE),
|
||||||
|
required=False,
|
||||||
|
description='This is a internal code for mainteing the secrets of the \
|
||||||
|
personal datas of the new holder')
|
||||||
transaction = SanitizedStr(validate=Length(min=1, max=STR_BIG_SIZE),
|
transaction = SanitizedStr(validate=Length(min=1, max=STR_BIG_SIZE),
|
||||||
required=False,
|
required=False,
|
||||||
description='The code used from the owner for \
|
description='The code used from the owner for \
|
||||||
|
|
|
@ -279,6 +279,7 @@ def test_allocate(user: UserClient):
|
||||||
snapshot, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
snapshot, _ = user.post(file('basic.snapshot'), res=models.Snapshot)
|
||||||
device_id = snapshot['device']['id']
|
device_id = snapshot['device']['id']
|
||||||
post_request = {"transaction": "ccc",
|
post_request = {"transaction": "ccc",
|
||||||
|
"finalUserCode": "aabbcc",
|
||||||
"name": "John",
|
"name": "John",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"endUsers": 1,
|
"endUsers": 1,
|
||||||
|
@ -294,6 +295,7 @@ def test_allocate(user: UserClient):
|
||||||
assert device['allocated'] == True
|
assert device['allocated'] == True
|
||||||
action = [a for a in device['actions'] if a['type'] == 'Allocate'][0]
|
action = [a for a in device['actions'] if a['type'] == 'Allocate'][0]
|
||||||
assert action['transaction'] == allocate['transaction']
|
assert action['transaction'] == allocate['transaction']
|
||||||
|
assert action['finalUserCode'] == allocate['finalUserCode']
|
||||||
assert action['created'] == allocate['created']
|
assert action['created'] == allocate['created']
|
||||||
assert action['startTime'] == allocate['startTime']
|
assert action['startTime'] == allocate['startTime']
|
||||||
assert action['endUsers'] == allocate['endUsers']
|
assert action['endUsers'] == allocate['endUsers']
|
||||||
|
@ -322,6 +324,7 @@ def test_allocate_bad_dates(user: UserClient):
|
||||||
delta = timedelta(days=30)
|
delta = timedelta(days=30)
|
||||||
future = datetime.now() + delta
|
future = datetime.now() + delta
|
||||||
post_request = {"transaction": "ccc",
|
post_request = {"transaction": "ccc",
|
||||||
|
"finalUserCode": "aabbcc",
|
||||||
"name": "John",
|
"name": "John",
|
||||||
"severity": "Info",
|
"severity": "Info",
|
||||||
"end_users": 1,
|
"end_users": 1,
|
||||||
|
|
|
@ -17,6 +17,7 @@ def test_simple_metrics(user: UserClient):
|
||||||
snapshot, _ = user.post(acer, res=ma.Snapshot)
|
snapshot, _ = user.post(acer, res=ma.Snapshot)
|
||||||
device_id = snapshot['device']['id']
|
device_id = snapshot['device']['id']
|
||||||
post_request = {"transaction": "ccc", "name": "John", "endUsers": 1,
|
post_request = {"transaction": "ccc", "name": "John", "endUsers": 1,
|
||||||
|
"finalUserCode": "abcdefjhi",
|
||||||
"devices": [device_id], "description": "aaa",
|
"devices": [device_id], "description": "aaa",
|
||||||
"startTime": "2020-11-01T02:00:00+00:00",
|
"startTime": "2020-11-01T02:00:00+00:00",
|
||||||
"endTime": "2020-12-01T02:00:00+00:00"
|
"endTime": "2020-12-01T02:00:00+00:00"
|
||||||
|
@ -59,6 +60,7 @@ def test_second_hdd_metrics(user: UserClient):
|
||||||
snapshot, _ = user.post(acer, res=ma.Snapshot)
|
snapshot, _ = user.post(acer, res=ma.Snapshot)
|
||||||
device_id = snapshot['device']['id']
|
device_id = snapshot['device']['id']
|
||||||
post_request = {"transaction": "ccc", "name": "John", "endUsers": 1,
|
post_request = {"transaction": "ccc", "name": "John", "endUsers": 1,
|
||||||
|
"finalUserCode": "abcdefjhi",
|
||||||
"devices": [device_id], "description": "aaa",
|
"devices": [device_id], "description": "aaa",
|
||||||
"startTime": "2020-11-01T02:00:00+00:00",
|
"startTime": "2020-11-01T02:00:00+00:00",
|
||||||
"endTime": "2020-12-01T02:00:00+00:00"
|
"endTime": "2020-12-01T02:00:00+00:00"
|
||||||
|
@ -100,6 +102,7 @@ def test_metrics_with_live_null(user: UserClient):
|
||||||
snapshot, _ = user.post(acer, res=ma.Snapshot)
|
snapshot, _ = user.post(acer, res=ma.Snapshot)
|
||||||
device_id = snapshot['device']['id']
|
device_id = snapshot['device']['id']
|
||||||
post_request = {"transaction": "ccc", "name": "John", "endUsers": 1,
|
post_request = {"transaction": "ccc", "name": "John", "endUsers": 1,
|
||||||
|
"finalUserCode": "abcdefjhi",
|
||||||
"devices": [device_id], "description": "aaa",
|
"devices": [device_id], "description": "aaa",
|
||||||
"startTime": "2020-11-01T02:00:00+00:00",
|
"startTime": "2020-11-01T02:00:00+00:00",
|
||||||
"endTime": "2020-12-01T02:00:00+00:00"
|
"endTime": "2020-12-01T02:00:00+00:00"
|
||||||
|
|
Reference in New Issue