Skip to content

pthethanh/testing-mongodb-with-gomock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

testing-mongodb-with-gomock

This is a demonstration of mocking MongoDB with gomock.

Get the code and run the test :)

Get it: go get -u github.com/golovers/testing-mongodb-with-gomock

Run it: go test -v pkg/users/* Result:

=== RUN   TestMongoDB
=== PAUSE TestMongoDB
=== RUN   TestAddUser
=== PAUSE TestAddUser
=== RUN   TestGetUserEmptyResponse
=== PAUSE TestGetUserEmptyResponse
=== RUN   TestGetUserNonEmptyResponse
=== PAUSE TestGetUserNonEmptyResponse
=== CONT  TestMongoDB
=== CONT  TestGetUserNonEmptyResponse
=== CONT  TestGetUserEmptyResponse
--- PASS: TestGetUserNonEmptyResponse (0.00s)
--- PASS: TestMongoDB (0.00s)
=== CONT  TestAddUser
--- PASS: TestAddUser (0.00s)
--- PASS: TestGetUserEmptyResponse (0.00s)
PASS
ok      command-line-arguments  (cached)

About

demonstrate mocking mongodb with gomock

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages