def main(): api = client_from_url("http://localhost:8000/spore") # Put the definition token = api.put_definition( model_name=todo, data={ "title": "todo", "description": "A list of my stuff to do", "fields": [ { "name": "item", "type": "string", "description": "The task todo." }, { "name": "status", "type": "enum", "choices": [ "todo", "done" ], "description": "Status of the task." } ]}) # Post some data data_item = api.post_data(model_name=todo, data=dict(item='make it work', status='todo')) # Update some data api.put_data_item(model_name=todo, data_item_id=data_item['id'], data={'item': 'make it work', 'status': 'done'}) print api.get_data(model_name=todo) # Delete definition and data api.delete_definition(model_name=todo, data={'token': token['token']})
def __init__(self, *args, **kwargs): # Requests self.spore_url = 'http://localhost:8080/spore' self.client = client_from_url(self.spore_url) return super(FunctionalTest, self).__init__(*args, **kwargs)