--- title: Muck acceptance tests author: Lars Wirzenius / The Ick project ... Introduction ============================================================================= Muck is a persistent in-memory JSON store with an HTTP API and advanced access control using signed JWT access tokens. This document presents its automated acceptance tests, using a (for now hypothetical) language similar to the Gherkin language implemented by Cucumber, called Fable. A happy path scenario ============================================================================= This scenario does some basic resource management via the Muck API. Start Muck. This also sets up access to it for the user by getting an access token, which will be used for all requests. ```fable given a running Muck ``` Check server status. ```fable then there are no resources in Muck ``` Create a simple resource. Remember its id. ```fable given I am tomjon when I create a resource {"foo": "bar"} then there is 1 resource in Muck and remember the resource id as ID and remember the resource revision as REV1 ``` Retrieve the resource. ```fable when I fetch resource ID then I get {"foo": "bar"} and it is mine and it has revision REV1 ``` Make sure another user can't retreive, update, or delete the resource. ```fable given I am verence when I fetch resource ID then it doesn't exist when I update ID, revision REV1, with {"foo": "somethingelse"} then it doesn't exist when I delete ID then it doesn't exist ``` Update the resource. ```fable given I am tomjon when I update ID, revision wrong, with {"foo": "somethingelse"} then it doesnt't work when I update ID, revision REV1, with {"foo": "somethingelse"} then it works and remember the resource revision as REV2 ``` Check the resource has been updated. ```fable when I fetch resource ID then I get {"foo": "somethingelse"} and it is mine and it has revision REV2 ``` Restart Muck. The resource should still exist. ```fable when Muck is restarted and I fetch resource ID then I get {"foo": "somethingelse"} and it is mine and it has revision REV2 ``` Search for the resource. First with a condition that is no longer true. ```fable when I search for foo being bar then there are no matches ``` Now search for the correct value. ```fable when I search for foo being somethingelse then I only get resource ID ``` Delete the resource. ```fable when I delete ID then it works ``` ```fable when I fetch resource ID then it doesn't exist ``` Restart Muck again. The resource should not exist. ```fable when Muck is restarted and I fetch resource ID then it doesn't exist ``` All done.