Newer
Older
#
# Copyright (C) 2021 Associated Universities, Inc. Washington DC, USA.
#
# This file is part of NRAO Workspaces.
#
# Workspaces is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Workspaces is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Workspaces. If not, see <https://www.gnu.org/licenses/>.
from typing import List
import pytest
from pyramid.config import Configurator
from pyramid.interfaces import IRoutesMapper
RouteList = List[str]
@pytest.fixture()
def capability_routes() -> RouteList:
return [
"home",
"view_capability",
"view_active_capability_requests",
"view_created_capability_requests",
"create_capability",
"edit_capability",
"enable_capability",
"disable_capability",

Andrew Kapuscinski
committed
"pause_capability",
"unpause_capability",
"view_capability_request",
"create_capability_request",
"create_and_submit_capability_request",
"launch_capability_request_from_ingestion_details",

Charlotte Hausman
committed
"create_follow_on_capability_request",
"edit_capability_request",
"submit_capability_request",
"cancel_capability_request",
"delete_capability_request",
"view_all_versions",

Nathan Hertz
committed
"view_latest_version",
"view_specific_version",
"submit_capability_version",
"add_file_to_latest",
"create_version_from_previous_execution_script",
]
def test_routes_exist(test_config: Configurator, capability_routes: RouteList):
"""
Tests that the Pyramid config has the proper capability routes set up
:param test_config: Mock pyramid config for testing purposes
"""
test_config.include("capability.routes")
mapper = test_config.registry.queryUtility(IRoutesMapper)
route_names = [route.name for route in mapper.get_routes()]
assert capability_routes == route_names