Skip to content
This repository has been archived by the owner on Dec 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #14 from microservices-demo/api/mock
Browse files Browse the repository at this point in the history
Api/mock
  • Loading branch information
pidster authored Sep 23, 2016
2 parents 95332f5 + 15f7830 commit e272abf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ dockertravisbuild: build
docker login -u $(DOCKER_USER) -p $(DOCKER_PASS)
scripts/push.sh


mockservice:
docker run -d --name user-mock -h user-mock -v $(PWD)/apispec/mock.json:/data/db.json clue/json-server

dockertest: dockerruntest
scripts/testcontainer.sh
docker run -h openapi --rm --name $(OPENAPI) --link user-dev -v $(PWD)/apispec/:/tmp/specs/\
Expand All @@ -71,10 +75,10 @@ dockertest: dockerruntest
$(MAKE) cleandocker

cleandocker:
-docker stop $(INSTANCE)-dev
-docker stop my$(TESTDB)
-docker rm my$(TESTDB)
-docker rm $(INSTANCE)-dev
-docker rm -f my$(TESTDB)
-docker rm -f $(INSTANCE)-dev
-docker rm -f $(OPENAPI)
-docker rm -f user-mock

clean: cleandocker
rm -rf bin
Expand Down
2 changes: 1 addition & 1 deletion apispec/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ hooks.before("/register > POST", function(transaction, done) {
transaction.request.headers['Content-Type'] = 'application/json';
transaction.request.body = JSON.stringify(
{
"username":"testuser",
"username": "testuser",
"password": "testpassword"
}
);
Expand Down
27 changes: 27 additions & 0 deletions apispec/mock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"customers": [
{ "id": "57a98d98e4b00679b4a830af",
"firstName": "Test",
"lastname": "Test",
"username": "testymctestface"
}
],
"cards": [
{
"id": "57a98d98e4b00679b4a830ae",
"longNum": "23232*****2131",
"expires": "12/18",
"ccv": "940"
}
],
"addresses": [
{
"id": "57a98d98e4b00679b4a830ad",
"number": "12",
"street": "Cleverstreet",
"city": "Tinytown",
"postcode": "1923eq",
"country": "Cambodia"
}
]
}

0 comments on commit e272abf

Please sign in to comment.