Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Added test for latest run page
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Oct 17, 2019
1 parent d161385 commit 84453c9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions src/vng/servervalidation/tests/tests_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,3 +801,35 @@ def test_server_run_detail_uses_latest_results(self):

self.assertIn('https://img.shields.io/', response.text)
self.assertNotIn('no results yet for this environment', response.text)


class LatestServerRunTests(WebTest):

def setUp(self):
self.user = UserFactory.create()
self.test_scenario = TestScenarioFactory.create()
self.environment = EnvironmentFactory.create(
test_scenario=self.test_scenario,
user=self.user
)

def test_latest_run_page_redirects_to_latest_run(self):
server_run1 = ServerRunFactory.create(
test_scenario=self.test_scenario,
user=self.user,
stopped="2019-01-01T12:00:00Z",
environment=self.environment
)
server_run2 = ServerRunFactory.create(
test_scenario=self.test_scenario,
user=self.user,
stopped="2019-01-01T15:00:00Z",
environment=self.environment
)

response = self.app.get(reverse('server_run:server-run_latest', kwargs={
'scenario_uuid': self.test_scenario.uuid,
'env_uuid': self.environment.uuid
}), user=self.user)

self.assertIn(str(server_run2.id), response.text)
2 changes: 1 addition & 1 deletion src/vng/servervalidation/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
path('<uuid:uuid>/', views.ServerRunOutputUuid.as_view(), name='server-run_detail'),
path('<int:api_id>/', views.TestScenarioList.as_view(), name='test-scenario_list'),
path('<uuid:scenario_uuid>/<uuid:env_uuid>/', views.ServerRunList.as_view(), name='server-run_list'),
path('<uuid:scenario_uuid>/<uuid:env_uuid>/latest', views.LatestRunView.as_view(), name='server-run_latest'),
path('<uuid:scenario_uuid>/<uuid:env_uuid>/latest/', views.LatestRunView.as_view(), name='server-run_latest'),
# path('', views.ServerRunList.as_view(), name='server-run_list'),
]

0 comments on commit 84453c9

Please sign in to comment.