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})
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
def test_update_item_not_found_2(): tarallo_session = Tarallo(t_url, t_token) tarallo_session.update_features('NONEXISTANT', {'color': None})
def test_update_item_not_found(): tarallo_session = Tarallo(t_url, t_token) tarallo_session.update_features('NONEXISTENT', {'color': 'red'})
def test_empty_update(): tarallo_session = Tarallo(t_url, t_token) tarallo_session.update_features('R189', {})
def test_impossible_update_no_such_feature(): tarallo_session = Tarallo(t_url, t_token) tarallo_session.update_features('R198', {'nonexistent': 'foo'})
def test_impossible_update(): tarallo_session = Tarallo(t_url, t_token) tarallo_session.update_features('R198', {'color': 'impossible'})