Skip to content

Commit

Permalink
Fix ssl tests for service
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoretti committed Feb 14, 2024
1 parent 27098bd commit 7322160
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/integration/bucketfs_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from inspect import cleandoc
import random
import string
from inspect import cleandoc
from typing import (
ByteString,
Iterable,
Expand All @@ -9,6 +9,7 @@
)

import pytest
import requests
from integration.conftest import (
File,
TestConfig,
Expand Down Expand Up @@ -132,11 +133,12 @@ def test_ssl_verification_for_bucketfs_service_fails(httpsserver):
bucketfs_service_response = "Client should not be able to retrieve this!"
httpsserver.serve_content(bucketfs_service_response, 200)
CREDENTAILS = {"default": {"username": "w", "password": "write"}}
bucketfs = Service(httpsserver.url, CREDENTAILS)
service = Service(httpsserver.url, CREDENTAILS)

with pytest.raises(requests.exceptions.SSLError) as execinfo:
_ = [bucket for bucket in service]
assert "CERTIFICATE_VERIFY_FAILED" in str(execinfo)

expected = ['default', 'demo_foo', 'demo_bar']
actual = [bucket for bucket in bucketfs]
assert expected == actual

def test_ssl_verification_for_bucketfs_service_can_be_bypassed(httpsserver):
bucketfs_service_response = cleandoc(
Expand All @@ -151,6 +153,6 @@ def test_ssl_verification_for_bucketfs_service_can_be_bypassed(httpsserver):
CREDENTAILS = {"default": {"username": "w", "password": "write"}}
bucketfs = Service(httpsserver.url, CREDENTAILS, verify=False)

expected = ['default', 'demo_foo', 'demo_bar']
expected = ["default", "demo_foo", "demo_bar"]
actual = [bucket for bucket in bucketfs]
assert expected == actual

0 comments on commit 7322160

Please sign in to comment.