def test_all_valid_examples_succeed(self): for v in get_valid_examples(): self.assertTrue(is_valid_resource(v)) validate_resource(v)
def test_valid_and_invalid_examples_are_not_the_same(self): for v in get_valid_examples(): for i in get_invalid_examples(): self.assertNotEqual(v, i, "A valid example can not be invalid.")
from schul_cloud_resources_api_v1.schema import get_valid_examples from schul_cloud_resources_api_v1 import ApiClient, ResourceApi from schul_cloud_resources_server_tests.app import run as run_test_server_app from schul_cloud_resources_server_tests.tests.fixtures import * from schul_cloud_url_crawler import ResourceClient, CrawledResource import time import requests from unittest.mock import Mock from collections import namedtuple # configuration NUMBER_OF_VALID_RESOURCES = 3 STARTUP_TIMEOUT = 2 # seconds # module constants VALID_RESOURCES = get_valid_examples() @pytest.fixture(scope="session") def host(): """The host of the application.""" return "localhost" @pytest.fixture(scope="session") def _server(): """The server to start the app.""" return StoppableWSGIRefServerAdapter() @pytest.fixture(scope="session")
def test_there_are_valid_examples(self): self.assertTrue(get_valid_examples())
def valid_resources(): """Return a list of valid ressoruces useable by tests.""" return get_valid_examples()