Tests: Add tests for duplicate views
Change-Id: I7284e15ec224021c4dfa72e8a70632f3ce8d8d3e
This commit is contained in:
parent
f6d93251b9
commit
fbd53732b3
@ -22,7 +22,7 @@ from jenkins_jobs.errors import JenkinsJobsException
|
||||
from tests.enum_scenarios import scenario_list
|
||||
|
||||
|
||||
fixtures_dir = Path(__file__).parent / "fixtures"
|
||||
fixtures_dir = Path(__file__).parent / "job_fixtures"
|
||||
|
||||
|
||||
@pytest.fixture(
|
27
tests/duplicates/test_view_duplicates.py
Normal file
27
tests/duplicates/test_view_duplicates.py
Normal file
@ -0,0 +1,27 @@
|
||||
from operator import attrgetter
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from jenkins_jobs.errors import JenkinsJobsException
|
||||
from tests.enum_scenarios import scenario_list
|
||||
|
||||
|
||||
fixtures_dir = Path(__file__).parent / "view_fixtures"
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
params=scenario_list(fixtures_dir),
|
||||
ids=attrgetter("name"),
|
||||
)
|
||||
def scenario(request):
|
||||
return request.param
|
||||
|
||||
|
||||
def test_yaml_snippet(scenario, check_view):
|
||||
if scenario.in_path.name.startswith("exception_"):
|
||||
with pytest.raises(JenkinsJobsException) as excinfo:
|
||||
check_view()
|
||||
assert str(excinfo.value).startswith("Duplicate ")
|
||||
else:
|
||||
check_view()
|
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.AllView>
|
||||
<name>sample-template-1.1</name>
|
||||
<description>Views for version 1.1<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
</hudson.model.AllView>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<hudson.model.AllView>
|
||||
<name>sample-template-2.0</name>
|
||||
<description>Views for version 2.0<!-- Managed by Jenkins Job Builder --></description>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
</hudson.model.AllView>
|
@ -0,0 +1,12 @@
|
||||
- view-template:
|
||||
name: sample-template-{version}
|
||||
view-type: all
|
||||
description: 'Views for version {version}'
|
||||
|
||||
- project:
|
||||
name: sample-project
|
||||
version: 1.1
|
||||
views:
|
||||
- sample-template-{version}
|
||||
- sample-template-{version}:
|
||||
version: 2.0
|
@ -0,0 +1,7 @@
|
||||
- view:
|
||||
name: duplicate-view
|
||||
view-type: all
|
||||
|
||||
- view:
|
||||
name: duplicate-view
|
||||
view-type: all
|
@ -0,0 +1,12 @@
|
||||
- view-template:
|
||||
name: duplicate-view-template
|
||||
view-type: all
|
||||
|
||||
- view-template:
|
||||
name: duplicate-view-template
|
||||
view-type: all
|
||||
|
||||
- project:
|
||||
name: sample-project
|
||||
views:
|
||||
- duplicate-view-template
|
@ -0,0 +1,9 @@
|
||||
- view-template:
|
||||
name: sample-template
|
||||
view-type: all
|
||||
|
||||
- project:
|
||||
name: sample-project
|
||||
views:
|
||||
- sample-template
|
||||
- sample-template
|
Loading…
Reference in New Issue
Block a user