File: get_resource_path_test.py

package info (click to toggle)
swagger-spec-validator 3.0.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 696 kB
  • sloc: python: 2,321; makefile: 28; sh: 2
file content (19 lines) | stat: -rw-r--r-- 564 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import pytest

from swagger_spec_validator.validator12 import get_resource_path


def test_fetch_from_file_uri_success():
    url, resource = "file://bla/bar", "/foo"
    assert "file://bla/foo.json", get_resource_path(url, resource)


def test_fetch_from_http_uri_success():
    url, resource = "http://bla/bar", "/foo"
    assert "http://bla/bar/foo", get_resource_path(url, resource)


def test_fetch_from_bad_file_uri_fail():
    with pytest.raises(AssertionError):
        url, resource = "file://bla/bar", "no_slash"
        get_resource_path(url, resource)