Esempio n. 1
0
def test_property_and_eval_function_provided(virtual_network):
    with pytest.raises(ValueError) as ve:
        oci.wait_until(virtual_network,
                       oci.Response(
                           200, {}, None,
                           oci.Request('GET', 'https://blah.example.org')),
                       'unit-test-prop',
                       'val',
                       evaluate_response=lambda x: isinstance(x, object))

    assert str(
        ve.value
    ) == 'If an evaluate_response function is provided, then the property argument cannot also be provided'
Esempio n. 2
0
def test_property_and_eval_function_provided(virtual_network):
    with pytest.raises(ValueError) as ve:
        oci.wait_until(virtual_network,
                       oci.Response(
                           200, {}, None,
                           oci.Request('GET', 'https://blah.example.org')),
                       'unit-test-prop',
                       'val',
                       evaluate_response=lambda x: isinstance(x, object))

    assert str(
        ve.value
    ) == 'Invalid wait_until configuration - can not provide both evaluate_response function and property argument, only one should be specified'
Esempio n. 3
0
def test_response():
    status = "mystatus"
    headers = {
        'h1': 'h1val',
        'opc-next-page': 'next!',
        'opc-request-id': 'myid'
    }
    data = 'testdata'
    request = oci.Request('method', 'url', 'query_params', 'header_params',
                          'body', 'response_type')

    response = oci.Response(status, headers, data, request)

    assert status == response.status
    assert 'h1val' == response.headers['h1']
    assert 'next!' == response.next_page
    assert 'myid' == response.request_id
    assert response.has_next_page is True