예제 #1
0
def test_validate_configuration_eap_invalid():
    with pytest.raises(ValueError):
        networking.WifiConfiguration(
            ssid="a",
            securityType="wpa-eap",
            psk="hohos"
        )
예제 #2
0
def test_eap_config_validate_invalid_eap_config():
    with pytest.raises(ValueError, match="Required .+ not present"):
        networking.WifiConfiguration(
            ssid="a",
            eapConfig={
                'eapType': 'peap/eap-mschapv2'
            }
        )
예제 #3
0
def test_validate_configuration_psk_invalid():
    with pytest.raises(ValueError):
        networking.WifiConfiguration(
            ssid="a",
            securityType="wpa-psk",
            eapConfig={
                'eapType': 'peap/eap-mschapv2',
                'identity': '*****@*****.**',
                'password': '******'
            }
        )
예제 #4
0
def test_validate_configuration_deduce_security_eap():
    n = networking.WifiConfiguration(
        ssid="a",
        eapConfig={
            'eapType': 'peap/eap-mschapv2',
            'identity': '*****@*****.**',
            'password': '******'
        }
    )
    expected = networking.NetworkingSecurityType.wpa_eap
    assert n.securityType == expected
예제 #5
0
def test_validate_configuration_deduce_security_invalid():
    """Test that we can't deduce security when both psk and eapConfig are
    present"""
    with pytest.raises(ValueError):
        networking.WifiConfiguration(
            ssid="a",
            psk="ee",
            eapConfig={
                'eapType': 'peap/eap-mschapv2',
                'identity': '*****@*****.**',
                'password': '******'
            }
        )
예제 #6
0
def test_eap_config_validate_missing_eap_type():
    with pytest.raises(ValueError, match="eapType must be defined"):
        networking.WifiConfiguration(ssid="a", eapConfig={})
예제 #7
0
def test_validate_configuration_deduce_security_psk():
    n = networking.WifiConfiguration(ssid="a", psk="abc")
    expected = networking.NetworkingSecurityType.wpa_psk
    assert n.securityType == expected
예제 #8
0
def test_validate_configuration_deduce_security_none():
    n = networking.WifiConfiguration(
        ssid="a"
    )
    expected = networking.NetworkingSecurityType.none
    assert n.securityType == expected