h1alexbel / fsl

FakeHub State Language. DSL for managing state in fakehub
MIT License
2 stars 0 forks source link
fakehub programming-language testing testing-fixtures

fsl. FakeHub State Language

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

just Crates.io Version codecov PDD status Hits-of-Code License Known Vulnerabilities

FSL is a specific DSL for managing state inside fakehub.

Motivation. When working with fakehub, automated testing tool that mocks GitHub REST API, we often require to setup initial state of the system with testing data. Instead of repeating testing preparations, we developed FSL, a language that takes file as an input, processes it, and creates FakeHub instance with desired data.

Quick Start

First, create init.fsl:

me: @jeff

+repo me/foo > foo
+repo me/bar
+issue "this is testing" +label "bug" -> foo

Here, we logged in as @jeff fake GitHub user, created two repositories: jeff/foo, jeff/bar, submitted new issue with title "this is testing" and "bug" label to jeff/foo.

To apply it on fakehub, run it (make sure you have fakehub installed):

fakehub start --include init.fsl -d

Then, pull newly created data:

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer @jeff" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  http://localhost:3000/repos/jeff/foo/issues/1

Response should be:

{
  "url": "http://localhost:3000/repos/jeff/foo/issues/1",
  "repository_url": "http://localhost:3000/repos/jeff/foo",
  "labels_url": "http://localhost:3000/repos/jeff/foo/issues/1/labels{/name}",
  ...
}

How to Use

TBD..

How to contribute?

Make sure that you have Rust and just installed on your system, then fork this repository, make changes, send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full build:

just full