Fix scopping error with panel validation

This fixes an issue where we were lumping each panel into all rows,
regardless of the yaml syntax provided.

Also add unit test for code coverage.

Change-Id: Ibc1e086d777692889f9c1dc26741e247bf90a985
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-09-18 14:54:20 -04:00
parent 5be3782e4a
commit f83e3e45d8
3 changed files with 62 additions and 1 deletions

View File

@ -44,9 +44,9 @@ class Panel(object):
self.text.update(self.base)
def _validate(self):
res = []
def f(data):
res = []
if not isinstance(data, list):
raise v.Invalid('Should be a list')

View File

@ -0,0 +1,45 @@
{
"dashboard": {
"rows": [
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"editable": true,
"error": false,
"limit": 10,
"mode": "starred",
"query": "",
"span": 12,
"tag": "",
"title": "Starred Dashboards",
"type": "dashlist"
}
],
"showTitle": false,
"title": "foo"
},
{
"collapse": false,
"editable": true,
"height": "250px",
"panels": [
{
"content": "Some example text is required.",
"editable": true,
"error": false,
"mode": "markdown",
"span": 12,
"title": "no title (click here)",
"type": "text"
}
],
"showTitle": false,
"title": "bar"
}
],
"title": "New dashboard"
}
}

View File

@ -0,0 +1,16 @@
dashboard:
title: New dashboard
rows:
- title: foo
height: 250px
panels:
- title: Starred Dashboards
type: dashlist
mode: starred
- title: bar
height: 250px
panels:
- title: no title (click here)
type: text
mode: markdown
content: Some example text is required.