Exemplo n.º 1
0
def test_invalid_query():
    """Test that the mnemonic query for an unauthorized user fails."""

    Mast.logout()

    mnemonic_identifier = 'IMIR_HK_ICE_SEC_VOLT4'
    start_time = Time('2019-01-16 00:00:00.000', format='iso')
    end_time = Time('2019-01-16 00:01:00.000', format='iso')
    try:
        query_single_mnemonic(mnemonic_identifier, start_time, end_time, token='1234')
    except RuntimeError:
        pass
Exemplo n.º 2
0
def test_invalid_query():
    """Test that the mnemonic query for an unauthorized user fails."""
    Mast.logout()

    mnemonic_identifier = 'IMIR_HK_ICE_SEC_VOLT4'
    start_time = Time('2019-01-16 00:00:00.000', format='iso')
    end_time = Time('2019-01-16 00:01:00.000', format='iso')

    with pytest.raises((ValueError, RuntimeError)) as error_message:
        query_single_mnemonic(mnemonic_identifier, start_time, end_time, token='1234')

    assert 'You are not authenticated in MAST' in str(error_message.value) or \
           'Must be logged in as an authorized user' in str(error_message.value)