Exemplo n.º 1
0
def test_can_create_botocore_session_debug():
    log_name = 'botocore.endpoint'
    assert_has_no_request_body_filter(log_name)

    factory.create_botocore_session(debug=True)

    assert_request_body_filter_in_log(log_name)
    assert logging.getLogger('').level == logging.DEBUG
Exemplo n.º 2
0
def test_can_create_botocore_session_debug():
    log_name = 'botocore.endpoint'
    assert_has_no_request_body_filter(log_name)

    factory.create_botocore_session(debug=True)

    assert_request_body_filter_in_log(log_name)
    assert logging.getLogger('').level == logging.DEBUG
Exemplo n.º 3
0
def test_can_create_botocore_session_with_multiple_configs():
    session = factory.create_botocore_session(
        connection_timeout=100,
        read_timeout=50,
        max_retries=5,
    )
    assert vars(session.get_default_client_config())['connect_timeout'] == 100
    assert vars(session.get_default_client_config())['read_timeout'] == 50
    assert vars(
        session.get_default_client_config())['retries']['max_attempts'] == 5
Exemplo n.º 4
0
def test_can_create_botocore_session_with_multiple_configs():
    session = factory.create_botocore_session(
        connection_timeout=100,
        read_timeout=50,
        max_retries=5,
    )
    assert vars(session.get_default_client_config())['connect_timeout'] == 100
    assert vars(session.get_default_client_config())['read_timeout'] == 50
    assert vars(
        session.get_default_client_config())['retries']['max_attempts'] == 5
Exemplo n.º 5
0
def test_can_create_botocore_session_max_retries():
    session = factory.create_botocore_session(max_retries=2)
    assert vars(
        session.get_default_client_config())['retries']['max_attempts'] == 2
Exemplo n.º 6
0
def test_can_create_botocore_session_read_timeout():
    session = factory.create_botocore_session(read_timeout=50)
    assert vars(session.get_default_client_config())['read_timeout'] == 50
Exemplo n.º 7
0
def test_can_create_botocore_session_connection_timeout():
    session = factory.create_botocore_session(connection_timeout=100)
    assert vars(session.get_default_client_config())['connect_timeout'] == 100
Exemplo n.º 8
0
def test_can_create_botocore_session():
    session = factory.create_botocore_session()
    assert session.user_agent().startswith('aws-chalice/')
    assert session.get_default_client_config() is None
Exemplo n.º 9
0
def test_can_create_botocore_session_debug():
    log_name = 'botocore.endpoint'
    assert_has_no_request_body_filter(log_name)
    factory.create_botocore_session(debug=True)
    assert_request_body_filter_in_log(log_name)
Exemplo n.º 10
0
def test_can_create_botocore_session():
    session = factory.create_botocore_session()
    assert session.user_agent().startswith('aws-chalice/')
Exemplo n.º 11
0
def test_can_create_botocore_session_max_retries():
    session = factory.create_botocore_session(max_retries=2)
    assert vars(
        session.get_default_client_config())['retries']['max_attempts'] == 2
Exemplo n.º 12
0
def test_can_create_botocore_session_read_timeout():
    session = factory.create_botocore_session(read_timeout=50)
    assert vars(session.get_default_client_config())['read_timeout'] == 50
Exemplo n.º 13
0
def test_can_create_botocore_session_connection_timeout():
    session = factory.create_botocore_session(connection_timeout=100)
    assert vars(session.get_default_client_config())['connect_timeout'] == 100
Exemplo n.º 14
0
def test_can_create_botocore_session():
    session = factory.create_botocore_session()
    assert session.user_agent().startswith('aws-chalice/')
    assert session.get_default_client_config() is None
Exemplo n.º 15
0
def get_boto3_session(user_agent_extra, profile, debug):
    botocore_session = create_botocore_session(profile=profile, debug=debug)
    botocore_session.user_agent_extra = user_agent_extra
    return boto3.session.Session(botocore_session=botocore_session)
Exemplo n.º 16
0
def test_can_create_botocore_session():
    session = factory.create_botocore_session()
    assert session.user_agent().startswith('aws-chalice/')