Skip to content

Commit

Permalink
toaster: More linting of tests
Browse files Browse the repository at this point in the history
Fix some more lint errors on the tests for toastergui.

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>
  • Loading branch information
townxelliot authored and rpurdie committed Oct 16, 2015
1 parent 0240d92 commit a31710d
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions lib/toaster/toastergui/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,18 @@ class AllProjectsPageTests(TestCase):

MACHINE_NAME = 'delorean'

def setUp(self):
""" Add default project manually """
project = Project.objects.create_project(CLI_BUILDS_PROJECT_NAME, None)
self.default_project = project
self.default_project.is_default = True
self.default_project.save()

# this project is only set for some of the tests
self.project = None

self.release = None

def _add_build_to_default_project(self):
""" Add a build to the default project (not used in all tests) """
now = timezone.now()
Expand All @@ -458,16 +470,6 @@ def _add_non_default_project(self):
value=self.MACHINE_NAME)
project_var.save()

def setUp(self):
""" Add default project manually """
project = Project.objects.create_project(CLI_BUILDS_PROJECT_NAME, None)
self.default_project = project
self.default_project.is_default = True
self.default_project.save()

# this project is only set for some of the tests
self.project = None

def test_default_project_hidden(self):
""" The default project should be hidden if it has no builds """
params = {"count": 10, "orderby": "updated:-", "page": 1}
Expand Down Expand Up @@ -573,17 +575,15 @@ def test_project_page_links(self):
# link for default project
row = soup.find('tr', attrs={'data-project': self.default_project.id})
cell = row.find('td', attrs={'data-project-field': 'name'})
url = cell.find('a')['href']
expected_url = reverse('projectbuilds', args=(self.default_project.id,))
self.assertEqual(url, expected_url,
self.assertEqual(cell.find('a')['href'], expected_url,
'link on default project name should point to builds')

# link for other project
row = soup.find('tr', attrs={'data-project': self.project.id})
cell = row.find('td', attrs={'data-project-field': 'name'})
url = cell.find('a')['href']
expected_url = reverse('project', args=(self.project.id,))
self.assertEqual(url, expected_url,
self.assertEqual(cell.find('a')['href'], expected_url,
'link on project name should point to configuration')

class ProjectBuildsPageTests(TestCase):
Expand Down Expand Up @@ -640,13 +640,6 @@ def setUp(self):
"outcome": Build.IN_PROGRESS
}

self.default_project_build_success = {
"project": self.default_project,
"started_on": now,
"completed_on": now,
"outcome": Build.SUCCEEDED
}

def _get_rows_for_project(self, project_id):
""" Helper to retrieve HTML rows for a project """
url = reverse("projectbuilds", args=(project_id,))
Expand Down

0 comments on commit a31710d

Please sign in to comment.