Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add testplan flag for show in total chart #22

Merged
merged 2 commits into from
Dec 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions cdws_api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ def _create_testplan(self, name, project_id,
def _update_testplan(self, testplan_id, name,
hidden=None, main=None,
statistic_filter=None, description=None,
variable_name=None, variable_value_regexp=None):
variable_name=None, variable_value_regexp=None,
summary=None):
data = {'name': name}
if main is not None:
data['main'] = main
Expand All @@ -152,6 +153,8 @@ def _update_testplan(self, testplan_id, name,
data['variable_name'] = variable_name
if variable_value_regexp is not None:
data['variable_value_regexp'] = variable_value_regexp
if summary is not None:
data['show_in_summary'] = summary
return self._call_rest('patch',
'testplans/{0}/'.format(testplan_id), data)

Expand Down Expand Up @@ -194,9 +197,14 @@ def test_hidden_flag(self):

def test_main_flag(self):
project = Project.objects.get(name='DummyTestProject')
data = self._create_testplan('HiddenByDefaultTrue', project.id)
data = self._create_testplan('MainByDefaultFalse', project.id)
self.assertFalse(data['main'])

def test_summary_flag(self):
project = Project.objects.get(name='DummyTestProject')
data = self._create_testplan('SummaryByDefaultFalse', project.id)
self.assertFalse(data['show_in_summary'])

def test_statistic_filter(self):
testplan = TestPlan.objects.get(name='DummyTestPlan')
self.assertEquals(testplan.filter, '')
Expand Down Expand Up @@ -265,6 +273,14 @@ def test_update_main_flag(self):
data = self._update_testplan(testplan.id, testplan.name, main=False)
self.assertFalse(data['main'])

def test_update_summary_flag(self):
testplan = TestPlan.objects.get(name='DummyTestPlan')
self.assertFalse(testplan.show_in_summary)
data = self._update_testplan(testplan.id, testplan.name, summary=True)
self.assertTrue(data['show_in_summary'])
data = self._update_testplan(testplan.id, testplan.name, summary=False)
self.assertFalse(data['show_in_summary'])

def test_update_hidden_flag(self):
testplan = TestPlan.objects.get(name='DummyTestPlan')
self.assertTrue(testplan.hidden)
Expand Down
20 changes: 20 additions & 0 deletions testreport/migrations/0035_testplan_summary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('testreport', '0034_extuser_dashboards'),
]

operations = [
migrations.AddField(
model_name='testplan',
name='summary',
field=models.BooleanField(verbose_name='Use for total chart', default=False),
preserve_default=True,
),
]
24 changes: 24 additions & 0 deletions testreport/migrations/0036_auto_20151218_1144.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('testreport', '0035_testplan_summary'),
]

operations = [
migrations.RemoveField(
model_name='testplan',
name='summary',
),
migrations.AddField(
model_name='testplan',
name='show_in_summary',
field=models.BooleanField(verbose_name='Consider in summary calculation', default=False),
preserve_default=True,
),
]
3 changes: 3 additions & 0 deletions testreport/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class TestPlan(models.Model):
variable_value_regexp = models.CharField(_('Regexp for variable value'),
max_length=255, default='',
blank=True)
show_in_summary = models.BooleanField(
_('Consider in summary calculation'),
blank=True, null=False, default=False)

def __str__(self):
return '{0} -> TestPlan: {1}'.format(self.project, self.name)
Expand Down