Update runscope plugin to use convert xml

- Add plugin="runscope" attribute for consistency
- Add full test
- Rename minimal test to be more descriptive

Change-Id: I9d0e1fea404f16d2ff4f8bde1d00510128a43b93
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2016-08-08 20:33:50 -04:00
parent 80aa526616
commit 6f83f6e755
5 changed files with 31 additions and 11 deletions

View File

@ -3243,20 +3243,26 @@ def runscope(parser, xml_parent, data):
:arg str access-token: OAuth Personal Access token. (required)
:arg int timeout: Timeout for test duration in seconds. (default 60)
Example:
Minimal Example:
.. literalinclude:: /../../tests/builders/fixtures/runscope.yaml
.. literalinclude:: /../../tests/builders/fixtures/runscope-minimal.yaml
:language: yaml
Full Example:
.. literalinclude:: /../../tests/builders/fixtures/runscope-full.yaml
:language: yaml
"""
runscope = XML.SubElement(xml_parent,
'com.runscope.jenkins.Runscope.RunscopeBuilder')
try:
XML.SubElement(runscope, 'triggerEndPoint').text = data[
"test-trigger-url"]
XML.SubElement(runscope, 'accessToken').text = data["access-token"]
except KeyError as e:
raise MissingAttributeError(e.args[0])
XML.SubElement(runscope, 'timeout').text = str(data.get('timeout', '60'))
runscope.set('plugin', 'runscope')
mapping = [
('test-trigger-url', 'triggerEndPoint', None),
('access-token', 'accessToken', None),
('timeout', 'timeout', 60),
]
convert_mapping_to_xml(runscope, data, mapping, fail_required=True)
def description_setter(parser, xml_parent, data):

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<com.runscope.jenkins.Runscope.RunscopeBuilder plugin="runscope">
<triggerEndPoint>https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger</triggerEndPoint>
<accessToken>123456</accessToken>
<timeout>123</timeout>
</com.runscope.jenkins.Runscope.RunscopeBuilder>
</builders>
</project>

View File

@ -0,0 +1,5 @@
builders:
- runscope:
test-trigger-url: "https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger"
access-token: "123456"
timeout: 123

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<com.runscope.jenkins.Runscope.RunscopeBuilder>
<com.runscope.jenkins.Runscope.RunscopeBuilder plugin="runscope">
<triggerEndPoint>https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger</triggerEndPoint>
<accessToken>123456</accessToken>
<timeout>60</timeout>

View File

@ -2,4 +2,3 @@ builders:
- runscope:
test-trigger-url: "https://api.runscope.com/radar/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/trigger"
access-token: "123456"
timeout: 60