Skip to content

Commit f479328

Browse files
feat(*): Minor fixes & initial docs
1 parent 597ecef commit f479328

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# API Stub Generator
22

3-
[![Build Status](https://travis-ci.org/CuriousLearner/api-stub.svg?branch=master)](https://travis-ci.org/CuriousLearner/api-stub)
3+
[![Build Status](https://travis-ci.org/CuriousLearner/API-stub-generator.svg?branch=master)](https://travis-ci.org/CuriousLearner/API-stub-generator)
44

55
Mock proposed API endpoints with stub.
66

@@ -10,6 +10,35 @@ I'm a lazy programmer. Basically, if you would tell me that I've to do the same
1010

1111
The proposed API docs I write, have to be then mocked for APP / Front-End Developers so that they're not blocked by actual API calls. Later they can replace these stubs with actual API calls. With more requirements coming in, the proposed endpoint changes over time and the stubs have to be updated. I found myself in a viscous circle of keeping the both up to date which wastes my dev cycles (where I can work on generating actual endpoints) & thus created this small utility to help me.
1212

13+
## Setup
14+
15+
Clone the repo & `cd` to it:
16+
17+
```
18+
git clone https://github.com/CuriousLearner/API-stub-generator.git && cd API-stub-generator
19+
```
20+
21+
Install pipenv
22+
23+
```
24+
[sudo] pip install pipenv
25+
```
26+
27+
Install all dependencies using pipenv
28+
29+
```
30+
pipenv install
31+
```
32+
33+
## Usage
34+
35+
Run `pipenv run python serialize_data.py` to generate JSON file named `endpoints_data.json`
36+
37+
Run `pipenv run python create_mock_endpoints.py` to generate `app.py` with all the code for the Mocked end points.
38+
39+
Run `pipenv run python app.py` & hit any endpoint that you defined in the `proposed_endpoints.md` doc.
40+
41+
1342
## GET - SET - GO
1443

1544
- Avoiding the viscous circle of updating docs and stubs in three easy steps.

tests/test_mock_endpoint_creation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@pytest.mark.datafiles(
1010
os.path.join(FIXTURE_DIR, 'endpoints_data.json'),
1111
)
12-
def test_data_serialization(datafiles):
12+
def test_generated_code_from_serialization(datafiles):
1313
data = datafiles.listdir()[0].read()
1414

1515
json_data = json.loads(data)

0 commit comments

Comments
 (0)