Exemplo n.º 1
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': '******'
                                     })
Exemplo n.º 2
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
Exemplo n.º 3
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': '******'
                                     })
Exemplo n.º 4
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'})
Exemplo n.º 5
0
def test_eap_config_validate_missing_eap_type():
    with pytest.raises(ValueError, match="eapType must be defined"):
        networking.WifiConfiguration(ssid="a", eapConfig={})
Exemplo n.º 6
0
def test_validate_configuration_eap_invalid():
    with pytest.raises(ValueError):
        networking.WifiConfiguration(ssid="a",
                                     securityType="wpa-eap",
                                     psk="hohos")
Exemplo n.º 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
Exemplo n.º 8
0
def test_validate_configuration_deduce_security_none():
    n = networking.WifiConfiguration(ssid="a")
    expected = networking.NetworkingSecurityType.none
    assert n.securityType == expected