code cleanup, UI change to menu to make it cleaner
This commit is contained in:
@@ -37,7 +37,7 @@ class TestScanAPIEndpoints:
|
||||
assert len(data['scans']) == 1
|
||||
assert data['scans'][0]['id'] == sample_scan.id
|
||||
|
||||
def test_list_scans_pagination(self, client, db):
|
||||
def test_list_scans_pagination(self, client, db, sample_db_config):
|
||||
"""Test scan list pagination."""
|
||||
# Create 25 scans
|
||||
for i in range(25):
|
||||
@@ -126,7 +126,7 @@ class TestScanAPIEndpoints:
|
||||
def test_trigger_scan_success(self, client, db, sample_db_config):
|
||||
"""Test triggering a new scan."""
|
||||
response = client.post('/api/scans',
|
||||
json={'config_file': str(sample_db_config)},
|
||||
json={'config_id': sample_db_config.id},
|
||||
content_type='application/json'
|
||||
)
|
||||
assert response.status_code == 201
|
||||
@@ -142,8 +142,8 @@ class TestScanAPIEndpoints:
|
||||
assert scan.status == 'running'
|
||||
assert scan.triggered_by == 'api'
|
||||
|
||||
def test_trigger_scan_missing_config_file(self, client, db):
|
||||
"""Test triggering scan without config_file."""
|
||||
def test_trigger_scan_missing_config_id(self, client, db):
|
||||
"""Test triggering scan without config_id."""
|
||||
response = client.post('/api/scans',
|
||||
json={},
|
||||
content_type='application/json'
|
||||
@@ -152,12 +152,12 @@ class TestScanAPIEndpoints:
|
||||
|
||||
data = json.loads(response.data)
|
||||
assert 'error' in data
|
||||
assert 'config_file is required' in data['message']
|
||||
assert 'config_id is required' in data['message']
|
||||
|
||||
def test_trigger_scan_invalid_config_file(self, client, db):
|
||||
"""Test triggering scan with non-existent config file."""
|
||||
def test_trigger_scan_invalid_config_id(self, client, db):
|
||||
"""Test triggering scan with non-existent config."""
|
||||
response = client.post('/api/scans',
|
||||
json={'config_file': '/nonexistent/config.yaml'},
|
||||
json={'config_id': 99999},
|
||||
content_type='application/json'
|
||||
)
|
||||
assert response.status_code == 400
|
||||
@@ -231,7 +231,7 @@ class TestScanAPIEndpoints:
|
||||
"""
|
||||
# Step 1: Trigger scan
|
||||
response = client.post('/api/scans',
|
||||
json={'config_file': str(sample_db_config)},
|
||||
json={'config_id': sample_db_config.id},
|
||||
content_type='application/json'
|
||||
)
|
||||
assert response.status_code == 201
|
||||
|
||||
Reference in New Issue
Block a user