コード例 #1
0
def test_maui_initialize_tagger_delete_non_existing(maui, maui_params):
    responses.add(responses.DELETE,
                  'http://api.example.org/mauiservice/dummy',
                  status=404,
                  json={
                      "status": 404,
                      "status_text": "Not Found",
                      "message": "The resource does not exist"
                  })
    responses.add(responses.POST,
                  'http://api.example.org/mauiservice/',
                  status=200,
                  json={})

    maui._initialize_tagger(params=maui_params)
コード例 #2
0
def test_maui_initialize_tagger_create_error(maui, maui_params):
    responses.add(responses.DELETE,
                  'http://api.example.org/mauiservice/dummy',
                  status=404,
                  json={
                      "status": 404,
                      "status_text": "Not Found",
                      "message": "The resource does not exist"
                  })
    responses.add(responses.POST,
                  'http://api.example.org/mauiservice/',
                  status=500)

    with pytest.raises(OperationFailedException):
        maui._initialize_tagger(params=maui_params)
コード例 #3
0
ファイル: test_backend_maui.py プロジェクト: peterruhm/Annif
def test_maui_initialize_tagger_create_failed(maui):
    responses.add(responses.DELETE,
                  'http://api.example.org/mauiservice/dummy',
                  status=404,
                  json={
                      "status": 404,
                      "status_text": "Not Found",
                      "message": "The resource does not exist"
                  })
    responses.add(responses.POST,
                  'http://api.example.org/mauiservice/',
                  body=requests.exceptions.RequestException())

    with pytest.raises(OperationFailedException):
        maui._initialize_tagger()