def test_modify_instruction(self):
     instruction = Instruction(1, 99, 1, time.time() - 200)
     brew_logic.store_instruction_for_unique_time(instruction)        
     json = '{ "description" : "modified description", "target_temperature_C" : "15.5", "from_timestamp" : "1000"}'        
     response = self._call_PUT_with_credentials_and_body('http://localhost:8080/chestfreezer/api/instruction/1', json, 'application/json')[0]
     assert(response.status == 204)        
     assert(db_adapter.get_instruction_by_id('1').from_timestamp == 1000)
     assert(db_adapter.get_instruction_by_id('1').description == 'modified description')
     assert(db_adapter.get_instruction_by_id('1').target_temperature_C == 15.5)
def _get_instruction(instruction_id):
    """ tries to get instruction via ID and aborts (404) if it can't be found """
    result = db_adapter.get_instruction_by_id(instruction_id)    
    if result is None:
        abort(404, 'Instruction with ID ' + instruction_id + ' does not exist.')
    return result