|
| 1 | +# fetchcode is a free software tool from nexB Inc. and others. |
| 2 | +# Visit https://github.com/aboutcode-org/fetchcode for support and download. |
| 3 | + |
| 4 | +# Copyright (c) nexB Inc. and others. All rights reserved. |
| 5 | +# http://nexb.com and http://aboutcode.org |
| 6 | + |
| 7 | +# This software is licensed under the Apache License version 2.0. |
| 8 | + |
| 9 | +# You may not use this software except in compliance with the License. |
| 10 | +# You may obtain a copy of the License at: |
| 11 | +# http://apache.org/licenses/LICENSE-2.0 |
| 12 | +# Unless required by applicable law or agreed to in writing, software distributed |
| 13 | +# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
| 14 | +# CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations under the License. |
| 16 | + |
| 17 | +from fetchcode import package |
| 18 | + |
| 19 | + |
| 20 | +def test_cocoapods_with_no_versions(monkeypatch): |
| 21 | + monkeypatch.setattr(package, "get_cocoapod_tags", lambda *args: None) |
| 22 | + assert list(package.get_cocoapods_data_from_purl("pkg:cocoapods/Example")) == [] |
| 23 | + |
| 24 | + |
| 25 | +def test_cocoapods_without_homepage(monkeypatch): |
| 26 | + monkeypatch.setattr(package, "get_cocoapod_tags", lambda *args: ["1.0"]) |
| 27 | + monkeypatch.setattr(package, "get_response", lambda url: {}) |
| 28 | + sentinel = object() |
| 29 | + monkeypatch.setattr(package, "construct_cocoapods_package", lambda *args: sentinel) |
| 30 | + assert list(package.get_cocoapods_data_from_purl("pkg:cocoapods/Example")) == [sentinel] |
0 commit comments