コード例 #1
0
def test_find_match_none():
    response = {
        'count': 1,
        'results': [
            {
                'name': 'bar'
            }
        ]
    }

    dash = Dashboard().with_name('foo')
    with pytest.raises(ResourceMatchNotFoundError):
        dash.__find_existing_match__(response)
コード例 #2
0
def test_find_match_exact():
    response = {
        'count': 1,
        'results': [
            {
                'name': 'foo'
            }
        ]
    }

    dash = Dashboard().with_name('foo')
    with pytest.raises(ResourceAlreadyExistsError):
        dash.__find_existing_match__(response)
コード例 #3
0
def test_find_match_duplicate_matches():
    response = {
        'count': 1,
        'results': [
            {
                'name': 'foo'
            },
            {
                'name': 'foo'
            }
        ]
    }
    dash = Dashboard().with_name('foo')
    with pytest.raises(ResourceHasMultipleExactMatchesError):
        dash.__find_existing_match__(response)
コード例 #4
0
def test_find_match_empty():
    dash = Dashboard()
    with pytest.raises(ResourceMatchNotFoundError):
        dash.__find_existing_match__({'count': 0})