Skip to content

CLI utility to make mocking as simple as possible.

Notifications You must be signed in to change notification settings

3DHubs/minstrel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minstrel

It's like... a jester mocks things, and jesters are a subclass of minstrels?

Minstrel is a CLI utility and Python module that combines a bunch of different strategies to make mocking as simple as possible. The goal here was to create mocks for our applications that developers would want to use.

To avoid the mocks from going stale, we're implementing a simple pattern. Each Minstrel file consists of several pars:

  • Base: the base object, which you'll be able to diff off of with patches.
  • Transports: objects containing configuration hints for different ways to persist the mocks. Currently supported:
    • SQL
      • table: the name of the table.
    • AMQP
      • exchange: the exchange to publish to.
      • routing_key: the routing key to publish with.
  • Derivatives: these are definitions for the derived objects, or for how to derive them.

Which means it could look like this, right now:

{
    "transports": {
        "sql": {
            "table": "foobar"
        }
    },
    "base": {
        "a": 1,
        "b": "foo"
    },
    "derivatives": [
        {
            "patches": [
                { "op": "replace", "path": "/a", "value": -1 }
            ],
        },
        {
            "patches": [
                { "op": "replace", "path": "/a", "value": 0 },
                { "op": "add", "path": "/c", "value": true }
            ],
        },
    ]
}

Development

I've been using Pipenv for this, so big props to Kenneth for this:

pipenv --three install

Installation

Running python setupy.py install will do, for now.