Skip to content
This repository was archived by the owner on Sep 1, 2020. It is now read-only.

Conversation

@ehsan-fmb
Copy link

and this is test file.

@ehsan-fmb
Copy link
Author

and other request is for give access to platform for send data to main server of iot project.

Copy link
Contributor

@1995parham 1995parham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check these commits and let me know 😄

func TestPosting(t *testing.T){
e := echo.New()
e.POST("/posting",JsonHandler)
var jsonStr = []byte(`{"lat":"20ms","lng":"english"}`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to have two separate tests for valid and invalid data that return different status codes.

rr := httptest.NewRecorder()
e.ServeHTTP(rr, req)
status := rr.Code
if status != http.StatusOK {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use tesify library for assertion in tests. Use assertion makes your test automatic.

@1995parham 1995parham changed the base branch from master to ehsan-fmb May 18, 2019 04:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants