Skip to content

Commit

Permalink
reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
yanchengnv committed Jan 31, 2025
1 parent ac4cc5a commit a5d5474
Showing 1 changed file with 11 additions and 60 deletions.
71 changes: 11 additions & 60 deletions tests/unit_test/fuel/f3/comm_config_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
# limitations under the License.
import pytest

from nvflare.apis.fl_constant import ConnectionSecurity
from nvflare.fuel.f3.comm_config_utils import requires_secure_connection
from nvflare.fuel.f3.drivers.driver_params import DriverParams


class TestCommConfigUtils:
Expand All @@ -25,64 +23,17 @@ class TestCommConfigUtils:
[
({}, False),
({"x": 1, "y": 2}, False),
({DriverParams.SECURE.value: True}, True),
({DriverParams.SECURE.value: False}, False),
({DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.INSECURE}, False),
({DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.TLS}, True),
({DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.MTLS}, True),
(
{
DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.MTLS,
},
True,
),
(
{
DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.TLS,
},
True,
),
(
{
DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.MTLS,
DriverParams.SECURE.value: False,
},
True,
),
(
{
DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.TLS,
DriverParams.SECURE.value: False,
},
True,
),
(
{
DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.MTLS,
DriverParams.SECURE.value: True,
},
True,
),
(
{
DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.TLS,
DriverParams.SECURE.value: True,
},
True,
),
(
{
DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.INSECURE,
DriverParams.SECURE.value: True,
},
False,
),
(
{
DriverParams.CONNECTION_SECURITY.value: ConnectionSecurity.INSECURE,
},
False,
),
({"secure": True}, True),
({"secure": False}, False),
({"connection_security": "insecure"}, False),
({"connection_security": "tls"}, True),
({"connection_security": "mtls"}, True),
({"connection_security": "mtls", "secure": False}, True),
({"connection_security": "mtls", "secure": True}, True),
({"connection_security": "tls", "secure": False}, True),
({"connection_security": "tls", "secure": True}, True),
({"connection_security": "insecure", "secure": False}, False),
({"connection_security": "insecure", "secure": True}, False),
],
)
def test_requires_secure_connection(self, resources, expected):
Expand Down

0 comments on commit a5d5474

Please sign in to comment.