Commit Graph

440 Commits

Author SHA1 Message Date
Héctor Hurtado
9266f48c7e First test 2019-10-07 16:00:14 +02:00
Héctor Hurtado
81379c22e2 First non-working version of server package 2019-10-07 13:48:35 +02:00
Roberto Abdelkader Martínez Pérez
10da324a57 Perform a race test after the tests 2019-10-07 08:55:34 +02:00
Roberto Abdelkader Martínez Pérez
47bd2be882 Some fixes suggested by golangci-lint 2019-10-07 08:53:48 +02:00
Roberto Abdelkader Martínez Pérez
7e54c26cb8 Don't test for false boolean value 2019-10-07 07:34:57 +02:00
Roberto Abdelkader Martínez Pérez
17020ad134 Some tests for Get/Post/Put/Delete utility functions 2019-10-07 07:33:35 +02:00
pancho horrillo
0b056f6cf0 internal/client/{get,set}_test.go: send io.Writer() based on []byte
* internal/client/get_test.go:
  - Revert changes when setting the Body of the mock (gock).
  - Revert over-eager line splitting.

* internal/client/set_test.go:
  - Use bytes.NewReader([]byte("200")) instead of strings.NewReader("200")

Thanks to @nilp0inter for the feedback!
2019-10-06 11:34:15 +02:00
pancho horrillo
f98784088d Normalize internal/client/*_test.go
* Adjust test style for easy reading, by using literals instead of vars
* Move comparison to the `bytes` domain, instead of `string`
* Simplify testing code by using bytes.Buffer directly
* More consistent naming of variables and dummies (HANDLE_{FOO,BAR,BAD})
* Consistent testing style of gock.IsDone()
* Stick to 80-column
2019-10-06 09:41:12 +02:00
Roberto Abdelkader Martínez Pérez
25409a2cee Exclude tests from race check 2019-10-05 12:28:01 +02:00
Roberto Abdelkader Martínez Pérez
382f056bbd Test for singleton handler map in package 2019-10-05 12:23:05 +02:00
Roberto Abdelkader Martínez Pérez
62ec810e6d Implemented user server state aka route list 2019-10-05 12:22:38 +02:00
Roberto Abdelkader Martínez Pérez
edb3f6fa1c More consistent naming 2019-10-05 11:44:37 +02:00
Roberto Abdelkader Martínez Pérez
60437ea9e5 Data server state aka handlers 2019-10-04 19:21:01 +02:00
Roberto Abdelkader Martínez Pérez
fb2f94997e Separate race detection from test phase to allow mutex tests 2019-10-04 19:20:32 +02:00
pancho horrillo
6154210b3f Update PoC and features with the 204 -> 404 update
Closes #33
2019-10-04 17:24:27 +02:00
Roberto Abdelkader Martínez Pérez
97b8c3fce4 Server data model 2019-10-04 16:28:19 +02:00
Héctor Hurtado
bbda43b193 Merge branch 'master' of ssh://github.com/BBVA/kapow 2019-10-04 14:33:00 +02:00
Héctor Hurtado
feaa836093 Connect set command. TODOs in route command 2019-10-04 14:32:39 +02:00
Roberto Abdelkader Martínez Pérez
4224984e1b Add spacing to comments 2019-10-04 14:18:42 +02:00
Roberto Abdelkader Martínez Pérez
bf88e6a78b Simplify test cases 2019-10-04 14:08:47 +02:00
Héctor Hurtado
6b34047d75 Added gock.IsDone() to route list and remove tests. Remove content type in route remove command. Removed disturbing data for texts. Remove unneeded test in set command. 2019-10-04 13:55:36 +02:00
Héctor Hurtado
b93a5a0c98 Fixed error specification of get and set commands in Data API 2019-10-04 13:17:29 +02:00
pancho horrillo
a865ade26a Use string concatenation to compose simple expression
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-04 07:28:08 +02:00
pancho horrillo
57d1aabb66 internal/cmd/route.go: replace dummies with calls to client code
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-04 06:46:40 +02:00
pancho horrillo
b9bf78abf4 Fix route_add{,_test}.go to use an io.Writer for saving the response
Also add a TODO regarding untested response payload.

Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-04 06:28:17 +02:00
pancho horrillo
219710bb76 Fix documentation comment
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-04 06:04:56 +02:00
pancho horrillo
c65d2ac548 Don't set MatchType to json in gock for requests without body 2019-10-03 22:50:42 +02:00
pancho horrillo
c01c3db4f9 Fix indentation and drop spurious whitespace 2019-10-03 22:48:21 +02:00
pancho horrillo
df96d322fc Don't set Content-Type to application/json in query without body 2019-10-03 22:47:43 +02:00
pancho horrillo
604569c7a3 Add internal/client/route_list{,_test}.go
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-03 22:42:31 +02:00
Roberto Abdelkader Martínez Pérez
6eb213a545 Adjust set and get to send no Content-Type 2019-10-03 20:57:40 +02:00
Roberto Abdelkader Martínez Pérez
2d712d39dc Adjust current implementation to accomodate content-type and test to check it 2019-10-03 20:56:53 +02:00
Roberto Abdelkader Martínez Pérez
4357b1ad20 Implementation of route add 2019-10-03 20:56:40 +02:00
Roberto Abdelkader Martínez Pérez
9f7fc8ce62 Allow user specify Content-Type header 2019-10-03 20:55:11 +02:00
pancho horrillo
013cd4d637 Add internal/client/route_remove{,_test}.go
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-03 18:22:18 +02:00
pancho horrillo
306889c958 Add TODO on closing the connection of the http.Client
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-03 16:52:55 +02:00
pancho horrillo
ffa262b2b6 Simplify internal/client/set.go by leveraging internal/http.Request()
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-03 16:52:15 +02:00
Roberto Abdelkader Martínez Pérez
b1c2db057c Shorthand functions request with common HTTP methods 2019-10-03 15:06:26 +02:00
Roberto Abdelkader Martínez Pérez
43abacbb2f Linter rules 2019-10-03 15:06:09 +02:00
Roberto Abdelkader Martínez Pérez
d854787cc2 Bump Go version to 1.13 2019-10-03 14:27:52 +02:00
Roberto Abdelkader Martínez Pérez
80eea3c886 Documentation and better naming 2019-10-03 14:17:24 +02:00
Roberto Abdelkader Martínez Pérez
681ee3cba8 http becomes an internal package 2019-10-03 14:12:14 +02:00
Roberto Abdelkader Martínez Pérez
0144569f58 Documentation 2019-10-03 14:11:06 +02:00
Roberto Abdelkader Martínez Pérez
d259e3b411 Replace implementation with kapow/http/response 2019-10-03 14:11:06 +02:00
Roberto Abdelkader Martínez Pérez
6689ed458c Better names for tests 2019-10-03 14:11:06 +02:00
Roberto Abdelkader Martínez Pérez
62f774e1cf Request module and tests 2019-10-03 14:11:06 +02:00
Roberto Abdelkader Martínez Pérez
8529ee056b Remove unused package 2019-10-03 14:11:06 +02:00
Roberto Abdelkader Martínez Pérez
9ff263a5f9 Update dependencies 2019-10-03 14:11:06 +02:00
pancho horrillo
23128026c7 Rework directory structure
Co-authored-by: Héctor Hurtado <hector.hurtado@bbva.com>
2019-10-03 12:05:53 +02:00
Héctor Hurtado
8b7d1d69e7 Added gock call validation 2019-10-03 10:43:51 +02:00