Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
arshamalh committed Dec 20, 2023
1 parent f18664c commit 5d3e5db
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@ build-docker: # Build the docker image

sample-docker: # Run docker with sample start command
docker run --rm ${name}:${version} start --token="something"

gen-mocks:
mockgen -destination=mocks/telebot_context.go -package=mocks gopkg.in/telebot.v3 Context
mockgen -source=docker/docker.go -destination=mocks/docker.go -package=mocks
mockgen -source=session/session.go -destination=mocks/session.go -package=mocks

2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.1 // indirect
Expand All @@ -27,6 +28,7 @@ require (
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/go-faker/faker/v4 v4.2.0
github.com/gogo/protobuf v1.3.2 // indirect
github.com/moby/moby v20.10.18+incompatible
github.com/opencontainers/go-digest v1.0.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/go-faker/faker/v4 v4.2.0 h1:dGebOupKwssrODV51E0zbMrv5e2gO9VWSLNC1WDCpWg=
github.com/go-faker/faker/v4 v4.2.0/go.mod h1:F/bBy8GH9NxOxMInug5Gx4WYeG6fHJZ8Ol/dhcpRub4=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
Expand Down Expand Up @@ -105,6 +107,8 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.4.0 h1:Z81tqI5ddIoXDPvVQ7/7CC9TnLM7ubaFG2qXYd5BbYY=
golang.org/x/time v0.4.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
39 changes: 39 additions & 0 deletions telegram/handlers/containers_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package handlers

import (
"testing"

"github.com/arshamalh/dockeroller/mocks"

Check failure on line 6 in telegram/handlers/containers_test.go

View workflow job for this annotation

GitHub Actions / test

no required module provides package github.com/arshamalh/dockeroller/mocks; to add it:
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)

func TestContainersList(t *testing.T) {
assert := assert.New(t)
ctrl := gomock.NewController(t)
docker := mocks.NewMockDocker(ctrl)
session := mocks.NewMockSession(ctrl)
ctx := mocks.NewMockContext(ctrl)

handler := &handler{
docker: docker,
session: session,
}

t.Run("no containers", func(t *testing.T) {
// Arrange: setting what should be returned from the mocks
docker.EXPECT().ContainersList()

// Act
err := handler.ContainersList(ctx)

// Assert
assert.Nil(err)
})

t.Run("picking first container and formatting", func(t *testing.T) {

})

t.Run("filling the session", func(t *testing.T) {})
}

0 comments on commit 5d3e5db

Please sign in to comment.