Beispiel #1
0
def test_parse_identity(monkeypatch):
    """
    This test reads the identity file from the ``test_data`` folder and
    tries to  authenticates with the password read from the PANSAT_PASSWORD
    environment variable.
    """
    accs.authenticate()
    login = accs.get_identity("Icare")
    assert login
Beispiel #2
0
def test_parse_data_provider_failure(monkeypatch):
    """
    This test reads the identity file from the ``test_data`` folder and
    request login information for an unknown provider. This test asserts
    that the expected exception is thrown.
    """
    accs.authenticate()
    with pytest.raises(accs.MissingProviderError):
        accs.get_identity("Unknown")
Beispiel #3
0
def test_parse_identity_failure(monkeypatch, tmpdir):
    """
    This test reads the identity file from the ``test_data`` folder and
    tries to authenticate with a wrong password. This test asserts that
    an exception is thrown.
    """
    test_data = Path(PurePath(__file__).parent / "test_data" / "identities.json")

    monkeypatch.setattr("os.environ", {})
    monkeypatch.setattr("getpass.getpass", lambda: "abcd")

    with pytest.raises(accs.WrongPasswordError):
        accs.parse_identity_file()
        accs.authenticate()
Beispiel #4
0
def test_parse_identity(monkeypatch):
    """
    This test reads the identity file from the ``test_data`` folder and
    tries to  authenticates with the password read from the PANSAT_PASSWORD
    environment variable.
    """
    test_data = Path(PurePath(__file__).parent / "test_data" / "identities.json")
    import pansat.download.accounts as accs

    monkeypatch.setattr("pansat.download.accounts._IDENTITY_FILE", test_data)
    monkeypatch.setattr("pansat.download.accounts._PANSAT_SECRET", None)

    accs.parse_identity_file()
    accs.authenticate()
    login = accs.get_identity("Icare")
    assert login
Beispiel #5
0
def test_parse_data_provider_failure(monkeypatch):
    """
    This test reads the identity file from the ``test_data`` folder and
    request login information for an unknown provider. This test asserts
    that the expected exception is thrown.
    """
    test_data = Path(PurePath(__file__).parent / "test_data" / "identities.json")
    import pansat.download.accounts as accs

    monkeypatch.setattr("pansat.download.accounts._IDENTITY_FILE", test_data)
    monkeypatch.setattr("pansat.download.accounts._PANSAT_SECRET", None)

    accs.parse_identity_file()
    accs.authenticate()
    with pytest.raises(accs.MissingProviderError):
        accs.get_identity("Unknown")
Beispiel #6
0
def test_parse_identity_failure(monkeypatch, tmpdir):
    """
    This test reads the identity file from the ``test_data`` folder and
    tries to authenticate with a wrong password. This test asserts that
    an exception is thrown.
    """
    test_data = Path(PurePath(__file__).parent / "test_data" / "identities.json")
    import pansat.download.accounts as accs

    monkeypatch.setattr("os.environ", {})
    monkeypatch.setattr("pansat.download.accounts._IDENTITY_FILE", test_data)
    monkeypatch.setattr("pansat.download.accounts._PANSAT_SECRET", None)
    monkeypatch.setattr("getpass.getpass", lambda: "abcd")

    with pytest.raises(accs.WrongPasswordError):
        accs.parse_identity_file()
        accs.authenticate()