|
| 1 | +# SPDX-License-Identifier: Apache-2.0 |
| 2 | +# |
| 3 | +# http://nexb.com and https://github.com/nexB/scancode.io |
| 4 | +# The ScanCode.io software is licensed under the Apache License version 2.0. |
| 5 | +# Data generated with ScanCode.io is provided as-is without warranties. |
| 6 | +# ScanCode is a trademark of nexB Inc. |
| 7 | +# |
| 8 | +# You may not use this software except in compliance with the License. |
| 9 | +# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0 |
| 10 | +# Unless required by applicable law or agreed to in writing, software distributed |
| 11 | +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 12 | +# CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 13 | +# specific language governing permissions and limitations under the License. |
| 14 | +# |
| 15 | +# Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES |
| 16 | +# OR CONDITIONS OF ANY KIND, either express or implied. No content created from |
| 17 | +# ScanCode.io should be considered or used as legal advice. Consult an Attorney |
| 18 | +# for any legal advice. |
| 19 | +# |
| 20 | +# ScanCode.io is a free software code scanning tool from nexB Inc. and others. |
| 21 | +# Visit https://github.com/nexB/scancode.io for support and download. |
| 22 | + |
| 23 | +from unittest import mock |
| 24 | + |
| 25 | +from django.test import TestCase |
| 26 | +from django.test import override_settings |
| 27 | +from django.urls import reverse |
| 28 | + |
| 29 | + |
| 30 | +@override_settings(SCANCODEIO_REQUIRE_AUTHENTICATION=False) |
| 31 | +class LicensesTest(TestCase): |
| 32 | + def test_license_list_view(self): |
| 33 | + url = reverse("license_list") |
| 34 | + response = self.client.get(url) |
| 35 | + self.assertEqual(response.status_code, 200) |
| 36 | + |
| 37 | + def test_license_details_view(self): |
| 38 | + keys = ["apache-2.0", "abcdefg"] |
| 39 | + license_url = reverse("license_details", args=(keys[0],)) |
| 40 | + dummy_license_url = reverse("license_details", args=(keys[1],)) |
| 41 | + response = [self.client.get(license_url), self.client.get(dummy_license_url)] |
| 42 | + self.assertEqual(response[0].status_code, 200) |
| 43 | + self.assertEqual(response[1].status_code, 404) |
0 commit comments