https://github.com/thylong/mongo_mock_go_example
How to mock MongoDB in Golang
https://github.com/thylong/mongo_mock_go_example
golang mgo2 mock mongodb testing
Last synced: 5 months ago
JSON representation
How to mock MongoDB in Golang
- Host: GitHub
- URL: https://github.com/thylong/mongo_mock_go_example
- Owner: thylong
- Created: 2016-10-23T01:11:28.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-02T13:39:31.000Z (over 7 years ago)
- Last Synced: 2025-08-14T04:35:04.805Z (10 months ago)
- Topics: golang, mgo2, mock, mongodb, testing
- Language: Go
- Homepage: http://thylong.com/golang/2016/mocking-mongo-in-golang/
- Size: 5.86 KB
- Stars: 32
- Watchers: 0
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
Mongo Mock example in Go
========================
This repository contains a simple way to mock Mgo driver.
If you're interested in it, you can find an article here : http://thylong.com/golang/2016/mocking-mongo-in-golang/
Installing
==========
.. code-block:: console
$ git clone git@github.com:thylong/mongo_mock_go_example.git
Quick-start
===========
If you want to test only the mock, you can run it this way :
.. code-block:: console
$ go get github.com/thylong/mongo_mock_go_example
$ go run main.go
If you want to test both the connection to Mongo and the mock, you can use the docker-compose file.
Nota Bene
=========
The code was tested with versions 1.7.* of Go.