コード例 #1
0
ファイル: test_link.py プロジェクト: jacobian/valor
def test_link_interpolate_args_identity(schema, session):
    class C(object):
        def identity(self):
            return "my-app"

    link = Service(schema, session).app.delete
    assert link.interpolate_args([C()]) == 'https://api.heroku.com/apps/my-app'
コード例 #2
0
ファイル: test_link.py プロジェクト: jacobian/valor
def test_link_interpolate_args_too_few(schema, session):
    link = Service(schema, session).app.delete
    with pytest.raises(TypeError):
        link.interpolate_args([])
コード例 #3
0
ファイル: test_link.py プロジェクト: jacobian/valor
def test_link_interpolate_args(schema, session):
    link = Service(schema, session).app.delete
    assert link.interpolate_args(['my-app']) == 'https://api.heroku.com/apps/my-app'
コード例 #4
0
ファイル: test_link.py プロジェクト: jacobian/valor
def test_link_construct_body_patternProperties(schema, session):
    link = Service(schema, session).config_var.update
    body = link.construct_body({'PIZZA_CRUST': 'thin'})
    assert json.loads(body) == {'PIZZA_CRUST': 'thin'}
コード例 #5
0
ファイル: test_link.py プロジェクト: jacobian/valor
def test_link_construct_body_missing_required_arg(schema, session):
    link = Service(schema, session).app.create
    link._link['schema']['required'] = ['stack']
    with pytest.raises(TypeError):
        link.construct_body({})
コード例 #6
0
ファイル: test_link.py プロジェクト: jacobian/valor
def test_link_construct_body_unexpected_arg(schema, session):
    link = Service(schema, session).app.create
    with pytest.raises(TypeError):
        link.construct_body({'stack': 'cedar', 'bad': 'arg'})
コード例 #7
0
ファイル: test_link.py プロジェクト: jacobian/valor
def test_link_construct_body_no_body(schema, session):
    link = Service(schema, session).app.delete
    assert link.construct_body({}) is None
    with pytest.raises(TypeError):
        link.construct_body({'bad': 'arg'})
コード例 #8
0
ファイル: test_link.py プロジェクト: jacobian/valor
def test_link_construct_body(schema, session):
    link = Service(schema, session).app.create
    body = link.construct_body({'stack': 'cedar'})
    assert json.loads(body) == {'stack': 'cedar'}
コード例 #9
0
ファイル: test_link.py プロジェクト: jacobian/valor
def test_link_interpolate_args_too_many(schema, session):
    link = Service(schema, session).app.delete
    with pytest.raises(TypeError):
        link.interpolate_args(['foo', 'bar'])