def test_log_on_variable(self): item = Item('fireflash') item.set_variable('hello', 'world') db_session.add(item) db_session.commit() logs = Log.find_all() assert len(logs) == 2 assert 'hello' in logs[0].message or 'hello' in logs[1].message
def test_api_update_variable(self): fireflash = Item('fireflash') fireflash.set_variable('test', 'one') fireflash.save() with app.test_client() as c: rv = self.get_json(c, '/api/item/fireflash/') data = json.loads(rv.data) data['vars'] = [{'key':'test', 'value':'two'}] rv = self.put_json(c, '/api/item/fireflash/', data) print rv assert rv.status_code == 200 fireflash = Item.find('fireflash') assert fireflash.variables['test'] == 'two'