From bd3359fb0eeaf402d5d65cbffeddcf604c09334b Mon Sep 17 00:00:00 2001
From: Androlo <andreas@erisindustries.com>
Date: Wed, 17 Jun 2015 23:53:32 +0200
Subject: [PATCH] Some more docs. Still 'today' in canada hehe

---
 api.md                         | 18 +++++++++---------
 erisdb/restServer.go           |  4 ++--
 test/mock/mock_web_api_test.go |  6 +++++-
 test/web_api/query_test.go     |  4 ++++
 test/web_api/web_api_test.go   |  6 +++++-
 5 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/api.md b/api.md
index 775e142a..b549023c 100644
--- a/api.md
+++ b/api.md
@@ -457,7 +457,7 @@ Event object:
 | Name | RPC method name | REST method | REST endpoint |
 | :--- | :-------------- | :---------: | :------------ |
 | [Call](#call) | erisdb.call | POST | `/calls` |
-| [CallCode](#call-code) | erisdb.callCode | POST | `/calls/code` |
+| [CallCode](#call-code) | erisdb.callCode | POST | `/codecalls` |
 
 
 ####Unsafe
@@ -1414,7 +1414,7 @@ TODO
 
 ***
 
-<a name="BroadcastTx"></a>
+<a name="broadcast-tx"></a>
 ####BroadcastTx
 
 Broadcast a given (signed) transaction to the node. It will be added to the tx pool if there are no issues, and if it is accepted by all validators it will eventually be committed to a block. 
@@ -1500,7 +1500,7 @@ See [The transaction types](#the-transaction-types) for more info on the `Tx` ty
 
 ***
 
-<a name="Call"></a>
+<a name="call"></a>
 ####Call
 
 Call a given (contract) account to execute its code with the given in-data. 
@@ -1541,8 +1541,8 @@ Parameters:
 
 ***
 
-<a name="CallCode"></a>
-####Call
+<a name="call-code"></a>
+####CallCode
 
 Pass contract code and tx data to the node and have it executed in the virtual machine. This is mostly a dev feature.
 
@@ -1550,7 +1550,7 @@ Pass contract code and tx data to the node and have it executed in the virtual m
 
 Method: POST
 
-Endpoint: `/calls/code`
+Endpoint: `/codecalls`
 
 Body: See JSON-RPC parameter.
 
@@ -1590,7 +1590,7 @@ These methods are unsafe because they require that a private key is either trans
 
 ***
 
-<a name="SignTx"></a>
+<a name="sign-tx"></a>
 ####SignTx
 
 Send an unsigned transaction to the node for signing. 
@@ -1627,7 +1627,7 @@ See [The transaction types](#the-transaction-types) for more info on the `Tx` ty
 
 ***
 
-<a name="Transact"></a>
+<a name="transact"></a>
 ####Transact
 
 Convenience method for sending a transaction "old Ethereum dev style". It will do the following things:
@@ -1679,7 +1679,7 @@ See [The transaction types](#the-transaction-types) for more info on the `CallTx
 
 ***
 
-<a name="GenPrivAccount"></a>
+<a name="gen-priv-account"></a>
 ####GenPrivAccount
 
 Convenience method for generating a `PrivAccount` object, which contains a private key and the corresponding public key and address.
diff --git a/erisdb/restServer.go b/erisdb/restServer.go
index 08819b27..2ad00cd7 100644
--- a/erisdb/restServer.go
+++ b/erisdb/restServer.go
@@ -62,8 +62,8 @@ func (this *RestServer) Start(config *server.ServerConfig, router *gin.Engine) {
 	router.POST("/txpool", this.handleBroadcastTx)
 	router.GET("/txpool", this.handleUnconfirmedTxs)
 	// Code execution
-	router.POST("/calls/:address", this.handleCall)
-	router.POST("/calls", this.handleCallCode)
+	router.POST("/calls", this.handleCall)
+	router.POST("/codecalls", this.handleCallCode)
 	// Unsafe
 	router.GET("/unsafe/pa_generator", this.handleGenPrivAcc)
 	router.POST("/unsafe/txpool", this.handleTransact)
diff --git a/test/mock/mock_web_api_test.go b/test/mock/mock_web_api_test.go
index cb8c6be4..0f9ddf6f 100644
--- a/test/mock/mock_web_api_test.go
+++ b/test/mock/mock_web_api_test.go
@@ -18,6 +18,7 @@ import (
 	"testing"
 	"os"
 	"runtime"
+	"time"
 )
 
 func init() {
@@ -65,6 +66,9 @@ func (this *MockSuite) TearDownSuite() {
 	sec := this.serveProcess.StopEventChannel()
 	this.serveProcess.Stop(0)
 	<-sec
+	// Tests are done rapidly, this is just to give that extra milliseconds 
+	// to shut down the previous server (may be excessive).
+	time.Sleep(500*time.Millisecond)
 }
 
 // ********************************************* Consensus *********************************************
@@ -163,7 +167,7 @@ func (this *MockSuite) Test_C2_UnconfirmedTxs() {
 }
 
 func (this *MockSuite) Test_C3_CallCode() {
-	resp := this.postJson("/calls", this.testData.Input.CallCode)
+	resp := this.postJson("/codecalls", this.testData.Input.CallCode)
 	ret := &ep.Call{}
 	errD := this.codec.Decode(ret, resp.Body)
 	this.NoError(errD)
diff --git a/test/web_api/query_test.go b/test/web_api/query_test.go
index 3c4c8534..40025794 100644
--- a/test/web_api/query_test.go
+++ b/test/web_api/query_test.go
@@ -15,6 +15,7 @@ import (
 	"os"
 	"path"
 	"testing"
+	"time"
 )
 
 type QuerySuite struct {
@@ -55,6 +56,9 @@ func (this *QuerySuite) TearDownSuite() {
 	sec := this.serveProcess.StopEventChannel()
 	this.serveProcess.Stop(0)
 	<-sec
+	// Tests are done rapidly, this is just to give that extra milliseconds 
+	// to shut down the previous server (may be excessive).
+	time.Sleep(500*time.Millisecond)
 }
 
 // ********************************************* Tests *********************************************
diff --git a/test/web_api/web_api_test.go b/test/web_api/web_api_test.go
index c607b629..3aacb358 100644
--- a/test/web_api/web_api_test.go
+++ b/test/web_api/web_api_test.go
@@ -18,6 +18,7 @@ import (
 	"os"
 	"path"
 	"testing"
+	"time"
 )
 
 type WebApiSuite struct {
@@ -59,6 +60,9 @@ func (this *WebApiSuite) TearDownSuite() {
 	sec := this.serveProcess.StopEventChannel()
 	this.serveProcess.Stop(0)
 	<-sec
+	// Tests are done rapidly, this is just to give that extra milliseconds 
+	// to shut down the previous server (may be excessive).
+	time.Sleep(500*time.Millisecond)
 }
 
 // ********************************************* Consensus *********************************************
@@ -157,7 +161,7 @@ func (this *WebApiSuite) Test_C2_UnconfirmedTxs() {
 }
 
 func (this *WebApiSuite) Test_C3_CallCode() {
-	resp := this.postJson("/calls", this.testData.Input.CallCode)
+	resp := this.postJson("/codecalls", this.testData.Input.CallCode)
 	ret := &ep.Call{}
 	errD := this.codec.Decode(ret, resp.Body)
 	this.NoError(errD)
-- 
GitLab