Skip to content

Commit

Permalink
Issue #202: Make sure the ipfs mock repo/stat endpoint behaves like ipfs
Browse files Browse the repository at this point in the history
This should fix tests.

License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
  • Loading branch information
hsanjuan committed Oct 26, 2017
1 parent 084e1f3 commit 5295334
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/ipfs_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ type mockIDResp struct {
}

type mockRepoStatResp struct {
RepoSize int
RepoCount int
RepoSize uint64
NumObjects uint64
StorageMax uint64
}

type mockConfigResp struct {
Expand Down Expand Up @@ -201,8 +202,9 @@ func (m *IpfsMock) handler(w http.ResponseWriter, r *http.Request) {
case "repo/stat":
len := len(m.pinMap.List())
resp := mockRepoStatResp{
RepoSize: len * 1000,
RepoCount: len,
RepoSize: uint64(len) * 1000,
NumObjects: uint64(len),
StorageMax: 10000000000, //10 GB
}
j, _ := json.Marshal(resp)
w.Write(j)
Expand Down

0 comments on commit 5295334

Please sign in to comment.