diff options
| author | Elliot Smith <elliot.smith@intel.com> | 2015-10-02 16:13:04 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-16 14:59:59 +0100 |
| commit | d96cedf51fd106e1f45db2556ad0f87f8cf84436 (patch) | |
| tree | 2b9514ab9afdcd3d5a6b7d90da3cd38113c8c1c4 | |
| parent | 7c8877efdea6f6a3b3bca2cce486d19102a9cdfa (diff) | |
| download | poky-d96cedf51fd106e1f45db2556ad0f87f8cf84436.tar.gz | |
bitbake: toaster: More linting of tests
Fix some more lint errors on the tests for toastergui.
(Bitbake rev: a31710db562a91da8ef37f5cd2231132474f46da)
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/toaster/toastergui/tests.py | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index 69bbfd43e4..7c4bd39db3 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py | |||
| @@ -433,6 +433,18 @@ class AllProjectsPageTests(TestCase): | |||
| 433 | 433 | ||
| 434 | MACHINE_NAME = 'delorean' | 434 | MACHINE_NAME = 'delorean' |
| 435 | 435 | ||
| 436 | def setUp(self): | ||
| 437 | """ Add default project manually """ | ||
| 438 | project = Project.objects.create_project(CLI_BUILDS_PROJECT_NAME, None) | ||
| 439 | self.default_project = project | ||
| 440 | self.default_project.is_default = True | ||
| 441 | self.default_project.save() | ||
| 442 | |||
| 443 | # this project is only set for some of the tests | ||
| 444 | self.project = None | ||
| 445 | |||
| 446 | self.release = None | ||
| 447 | |||
| 436 | def _add_build_to_default_project(self): | 448 | def _add_build_to_default_project(self): |
| 437 | """ Add a build to the default project (not used in all tests) """ | 449 | """ Add a build to the default project (not used in all tests) """ |
| 438 | now = timezone.now() | 450 | now = timezone.now() |
| @@ -458,16 +470,6 @@ class AllProjectsPageTests(TestCase): | |||
| 458 | value=self.MACHINE_NAME) | 470 | value=self.MACHINE_NAME) |
| 459 | project_var.save() | 471 | project_var.save() |
| 460 | 472 | ||
| 461 | def setUp(self): | ||
| 462 | """ Add default project manually """ | ||
| 463 | project = Project.objects.create_project(CLI_BUILDS_PROJECT_NAME, None) | ||
| 464 | self.default_project = project | ||
| 465 | self.default_project.is_default = True | ||
| 466 | self.default_project.save() | ||
| 467 | |||
| 468 | # this project is only set for some of the tests | ||
| 469 | self.project = None | ||
| 470 | |||
| 471 | def test_default_project_hidden(self): | 473 | def test_default_project_hidden(self): |
| 472 | """ The default project should be hidden if it has no builds """ | 474 | """ The default project should be hidden if it has no builds """ |
| 473 | params = {"count": 10, "orderby": "updated:-", "page": 1} | 475 | params = {"count": 10, "orderby": "updated:-", "page": 1} |
| @@ -573,17 +575,15 @@ class AllProjectsPageTests(TestCase): | |||
| 573 | # link for default project | 575 | # link for default project |
| 574 | row = soup.find('tr', attrs={'data-project': self.default_project.id}) | 576 | row = soup.find('tr', attrs={'data-project': self.default_project.id}) |
| 575 | cell = row.find('td', attrs={'data-project-field': 'name'}) | 577 | cell = row.find('td', attrs={'data-project-field': 'name'}) |
| 576 | url = cell.find('a')['href'] | ||
| 577 | expected_url = reverse('projectbuilds', args=(self.default_project.id,)) | 578 | expected_url = reverse('projectbuilds', args=(self.default_project.id,)) |
| 578 | self.assertEqual(url, expected_url, | 579 | self.assertEqual(cell.find('a')['href'], expected_url, |
| 579 | 'link on default project name should point to builds') | 580 | 'link on default project name should point to builds') |
| 580 | 581 | ||
| 581 | # link for other project | 582 | # link for other project |
| 582 | row = soup.find('tr', attrs={'data-project': self.project.id}) | 583 | row = soup.find('tr', attrs={'data-project': self.project.id}) |
| 583 | cell = row.find('td', attrs={'data-project-field': 'name'}) | 584 | cell = row.find('td', attrs={'data-project-field': 'name'}) |
| 584 | url = cell.find('a')['href'] | ||
| 585 | expected_url = reverse('project', args=(self.project.id,)) | 585 | expected_url = reverse('project', args=(self.project.id,)) |
| 586 | self.assertEqual(url, expected_url, | 586 | self.assertEqual(cell.find('a')['href'], expected_url, |
| 587 | 'link on project name should point to configuration') | 587 | 'link on project name should point to configuration') |
| 588 | 588 | ||
| 589 | class ProjectBuildsPageTests(TestCase): | 589 | class ProjectBuildsPageTests(TestCase): |
| @@ -640,13 +640,6 @@ class ProjectBuildsPageTests(TestCase): | |||
| 640 | "outcome": Build.IN_PROGRESS | 640 | "outcome": Build.IN_PROGRESS |
| 641 | } | 641 | } |
| 642 | 642 | ||
| 643 | self.default_project_build_success = { | ||
| 644 | "project": self.default_project, | ||
| 645 | "started_on": now, | ||
| 646 | "completed_on": now, | ||
| 647 | "outcome": Build.SUCCEEDED | ||
| 648 | } | ||
| 649 | |||
| 650 | def _get_rows_for_project(self, project_id): | 643 | def _get_rows_for_project(self, project_id): |
| 651 | """ Helper to retrieve HTML rows for a project """ | 644 | """ Helper to retrieve HTML rows for a project """ |
| 652 | url = reverse("projectbuilds", args=(project_id,)) | 645 | url = reverse("projectbuilds", args=(project_id,)) |
