forked from CGM_Public/pretix_original
Fix #3360 -- Allow to revoke devices before initialized
This commit is contained in:
@@ -72,6 +72,21 @@ def test_initialize_used_token(client, device: Device):
|
||||
assert resp.data == {'token': ['This initialization token has already been used.']}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_initialize_revoked_token(client, new_device: Device):
|
||||
new_device.revoked = True
|
||||
new_device.save()
|
||||
resp = client.post('/api/v1/device/initialize', {
|
||||
'token': new_device.initialization_token,
|
||||
'hardware_brand': 'Samsung',
|
||||
'hardware_model': 'Galaxy S',
|
||||
'software_brand': 'pretixdroid',
|
||||
'software_version': '4.0.0'
|
||||
})
|
||||
assert resp.status_code == 400
|
||||
assert resp.data == {'token': ['This initialization token has been revoked.']}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_initialize_valid_token(client, new_device: Device):
|
||||
resp = client.post('/api/v1/device/initialize', {
|
||||
|
||||
@@ -110,6 +110,17 @@ def test_revoke_device(event, admin_user, admin_team, device, client):
|
||||
assert device.revoked
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_revoke_device_before_initialization(event, admin_user, admin_team, device, client):
|
||||
client.login(email='dummy@dummy.dummy', password='dummy')
|
||||
device.save()
|
||||
|
||||
client.get('/control/organizer/dummy/device/{}/revoke'.format(device.pk))
|
||||
client.post('/control/organizer/dummy/device/{}/revoke'.format(device.pk), {}, follow=True)
|
||||
device.refresh_from_db()
|
||||
assert device.revoked
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_bulk_update_device(event, admin_user, admin_team, device, client):
|
||||
client.login(email='dummy@dummy.dummy', password='dummy')
|
||||
|
||||
Reference in New Issue
Block a user