Exemple #1
0
def test_serializable():
    base_url = 'http://test.ru'
    prefix = '/prefix'
    session_original = RemoteApiSession(base_url, prefix=prefix)
    serialization = pickle.dumps(session_original)
    del session_original
    session_loaded = pickle.loads(serialization)
    assert_that(session_loaded.base_url, is_(base_url))
    assert_that(session_loaded.prefix, is_(prefix))
Exemple #2
0
 def __init__(self, api_base_url, api_prefix, auth_origin, auth_prefix="/auth"):
     super().__init__(base_url=api_base_url, prefix=api_prefix)
     self.auth_api = RemoteApiSession(base_url=auth_origin, prefix=auth_prefix)
Exemple #3
0
def test_remote_api_build_url_with_prefix(prefix, url_path, expected):
    session = RemoteApiSession('http://test.ru', prefix=prefix)
    assert_that(session._build_url(session.url, url_path),
                is_(equal_to(expected)))
Exemple #4
0
def test_remote_api_build_url_with_prefix_and_nonorigin_base(
        base, prefix, url_path, expected):
    session = RemoteApiSession(base, prefix=prefix)
    assert_that(session._build_url(session.url, url_path),
                is_(equal_to(expected)))
Exemple #5
0
def test_remote_api_build_url():
    session = RemoteApiSession('http://test.ru')
    assert_that(session._build_url(session.url, '/test'),
                is_(equal_to('http://test.ru/test')))
Exemple #6
0
def test_remote_api_url_with_prefix(url, prefix, expected):
    session = RemoteApiSession(url, prefix=prefix)
    assert_that(session.url, is_(equal_to(expected)))
Exemple #7
0
def test_remote_api_url():
    url = 'http://test.ru'
    session = RemoteApiSession(url)
    assert_that(session.url, is_(equal_to(url)))
Exemple #8
0
def test_remote_api_prefix():
    url = 'http://test.ru'
    prefix = 'prefix'
    session = RemoteApiSession(url, prefix=prefix)
    assert_that(session.prefix, is_(equal_to(prefix)))
Exemple #9
0
def test_remote_api_create_instance():
    session = RemoteApiSession('http://test.ru')
    assert_that(session, instance_of(RequestsSession))