How to use the aiodocker.utils.parse_content_type function in aiodocker

To help you get started, we’ve selected a few aiodocker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aio-libs / aiodocker / tests / test_utils.py View on Github external
ct = "text/plain; charset=utf-8"
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {"charset": "utf-8"}

    ct = "text/plain; "
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {}

    ct = "text/plain; asdfasdf"
    with pytest.raises(ValueError):
        mt, st, opts = utils.parse_content_type(ct)
github aio-libs / aiodocker / tests / test_utils.py View on Github external
def test_parse_content_type():
    ct = "text/plain"
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {}

    ct = "text/plain; charset=utf-8"
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {"charset": "utf-8"}

    ct = "text/plain; "
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {}

    ct = "text/plain; asdfasdf"
    with pytest.raises(ValueError):
        mt, st, opts = utils.parse_content_type(ct)
github aio-libs / aiodocker / tests / test_utils.py View on Github external
def test_parse_content_type():
    ct = "text/plain"
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {}

    ct = "text/plain; charset=utf-8"
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {"charset": "utf-8"}

    ct = "text/plain; "
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {}
github aio-libs / aiodocker / tests / test_utils.py View on Github external
def test_parse_content_type():
    ct = "text/plain"
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {}

    ct = "text/plain; charset=utf-8"
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {"charset": "utf-8"}

    ct = "text/plain; "
    mt, st, opts = utils.parse_content_type(ct)
    assert mt == "text"
    assert st == "plain"
    assert opts == {}

    ct = "text/plain; asdfasdf"
    with pytest.raises(ValueError):
        mt, st, opts = utils.parse_content_type(ct)