Exemple #1
0
def test_delete_one_feature():
    tarallo_session = Tarallo(t_url, t_token)
    # Insert a frequency
    assert tarallo_session.update_features('R70',
                                           {'frequency-hertz': 800000000})

    # Remove it
    assert tarallo_session.update_features('R70', {'frequency-hertz': None})

    # Check that it's gone
    assert 'frequency-hertz' not in tarallo_session.get_item('R70').features

    # Add it again
    assert tarallo_session.update_features('R70',
                                           {'frequency-hertz': 800000000})
Exemple #2
0
def test_update_one_feature():
    tarallo_session = Tarallo(t_url, t_token)
    freq = tarallo_session.get_item('R777').features['frequency-hertz']

    if freq % 2 == 0:
        new_freq = freq + 1
    else:
        new_freq = freq - 1
    # If operation succeeds, return True
    assert tarallo_session.update_features('R777',
                                           {'frequency-hertz': new_freq})
    freq_updated = tarallo_session.get_item('R777').features['frequency-hertz']
    assert freq_updated == new_freq
Exemple #3
0
def test_update_item_not_found_2():
    tarallo_session = Tarallo(t_url, t_token)
    tarallo_session.update_features('NONEXISTANT', {'color': None})
Exemple #4
0
def test_update_item_not_found():
    tarallo_session = Tarallo(t_url, t_token)
    tarallo_session.update_features('NONEXISTENT', {'color': 'red'})
Exemple #5
0
def test_empty_update():
    tarallo_session = Tarallo(t_url, t_token)
    tarallo_session.update_features('R189', {})
Exemple #6
0
def test_impossible_update_no_such_feature():
    tarallo_session = Tarallo(t_url, t_token)
    tarallo_session.update_features('R198', {'nonexistent': 'foo'})
Exemple #7
0
def test_impossible_update():
    tarallo_session = Tarallo(t_url, t_token)
    tarallo_session.update_features('R198', {'color': 'impossible'})