##// END OF EJS Templates
oss-licenses: Fix tests for open source licenses view.
Martin Bornhold -
r220:bdf36d1f default
parent child Browse files
Show More
@@ -460,7 +460,11 b' class TestLabsSettings(object):'
460 460
461 461 @pytest.mark.usefixtures('app')
462 462 class TestOpenSourceLicenses(object):
463 def test_records_are_displayed(self, autologin_user):
463
464 def _get_url(self, request):
465 return ADMIN_PREFIX + '/settings/open_source'
466
467 def test_records_are_displayed(self, autologin_user, request_stub):
464 468 sample_licenses = {
465 469 "python2.7-pytest-2.7.1": {
466 470 "UNKNOWN": None
@@ -470,11 +474,10 b' class TestOpenSourceLicenses(object):'
470 474 }
471 475 }
472 476 read_licenses_patch = mock.patch(
473 'rhodecode.controllers.admin.settings.read_opensource_licenses',
477 'rhodecode.admin.views.read_opensource_licenses',
474 478 return_value=sample_licenses)
475 479 with read_licenses_patch:
476 response = self.app.get(
477 url('admin_settings_open_source'), status=200)
480 response = self.app.get(self._get_url(request_stub), status=200)
478 481
479 482 assert_response = AssertResponse(response)
480 483 assert_response.element_contains(
@@ -484,15 +487,15 b' class TestOpenSourceLicenses(object):'
484 487 for license in sample_licenses[name]:
485 488 assert_response.element_contains('.panel-body', license)
486 489
487 def test_records_can_be_read(self, autologin_user):
488 response = self.app.get(url('admin_settings_open_source'), status=200)
490 def test_records_can_be_read(self, autologin_user, request_stub):
491 response = self.app.get(self._get_url(request_stub), status=200)
489 492 assert_response = AssertResponse(response)
490 493 assert_response.element_contains(
491 494 '.panel-heading', 'Licenses of Third Party Packages')
492 495
493 def test_forbidden_when_normal_user(self, autologin_regular_user):
494 self.app.get(
495 url('admin_settings_open_source'), status=403)
496 def test_forbidden_when_normal_user(self, autologin_regular_user,
497 request_stub):
498 self.app.get(self._get_url(request_stub), status=403)
496 499
497 500
498 501 @pytest.mark.usefixtures("app")
General Comments 0
You need to be logged in to leave comments. Login now