Add OS name and version to stored device information (#3434)

Co-authored-by: Raphael Michel <michel@rami.io>
This commit is contained in:
robbi5
2023-06-28 09:02:07 +02:00
committed by GitHub
parent fc94fbd9c8
commit db7c52ca93
8 changed files with 77 additions and 1 deletions

View File

@@ -94,6 +94,8 @@ def test_initialize_valid_token(client, new_device: Device):
'hardware_brand': 'Samsung',
'hardware_model': 'Galaxy S',
'software_brand': 'pretixdroid',
'os_name': 'Android',
'os_version': '2.3.3',
'software_version': '4.0.0'
})
assert resp.status_code == 200
@@ -105,6 +107,7 @@ def test_initialize_valid_token(client, new_device: Device):
new_device.refresh_from_db()
assert new_device.api_token
assert new_device.initialized
assert new_device.os_version == "2.3.3"
@pytest.mark.django_db
@@ -142,6 +145,8 @@ def test_update_valid_fields(device_client, device: Device):
resp = device_client.post('/api/v1/device/update', {
'hardware_brand': 'Samsung',
'hardware_model': 'Galaxy S',
'os_name': 'Android',
'os_version': '2.3.3',
'software_brand': 'pretixdroid',
'software_version': '5.0.0',
'info': {
@@ -151,9 +156,23 @@ def test_update_valid_fields(device_client, device: Device):
assert resp.status_code == 200
device.refresh_from_db()
assert device.software_version == '5.0.0'
assert device.os_version == '2.3.3'
assert device.info == {'foo': 'bar'}
@pytest.mark.django_db
def test_update_valid_without_optional_fields(device_client, device: Device):
resp = device_client.post('/api/v1/device/update', {
'hardware_brand': 'Samsung',
'hardware_model': 'Galaxy S',
'software_brand': 'pretixdroid',
'software_version': '5.0.0',
}, format='json')
assert resp.status_code == 200
device.refresh_from_db()
assert device.software_version == '5.0.0'
@pytest.mark.django_db
def test_keyroll_required_auth(client, token_client, device: Device):
resp = client.post('/api/v1/device/roll', {})

View File

@@ -35,6 +35,8 @@ def device(organizer, event):
unique_serial="UOS3GNZ27O39V3QS",
initialization_token="frkso3m2w58zuw70",
hardware_model="TC25",
os_name="Android",
os_version="8.1.0",
software_brand="pretixSCAN",
software_version="1.5.1",
initialized=now(),
@@ -58,6 +60,8 @@ TEST_DEV_RES = {
"initialized": "2020-09-18T14:17:44.190021Z",
"hardware_brand": "Zebra",
"hardware_model": "TC25",
"os_name": "Android",
"os_version": "8.1.0",
"software_brand": "pretixSCAN",
"software_version": "1.5.1",
"security_profile": "full"