Skip to content

Commit

Permalink
update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
berejant committed Oct 1, 2024
1 parent 5d43bed commit 6cabd3e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 75 deletions.
39 changes: 20 additions & 19 deletions ApiController_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"errors"
"github.com/berejant/go-kneu"
kneuMocks "github.com/berejant/go-kneu/mocks"
"github.com/golang-jwt/jwt/v5"
"github.com/kneu-messenger-pigeon/authorizer/dto"
"github.com/kneu-messenger-pigeon/events"
Expand Down Expand Up @@ -64,7 +65,7 @@ func TestGetAuthUrl(t *testing.T) {

var receivedState string

oauthClient := kneu.NewMockOauthClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)
oauthClient.On(
"GetOauthUrl", config.publicUrl+"/complete",
mock.MatchedBy(func(state string) bool {
Expand Down Expand Up @@ -151,8 +152,8 @@ func TestCompleteAuth(t *testing.T) {
userId := uint(999)
studentId := uint(123)

oauthClient := kneu.NewMockOauthClientInterface(t)
apiClient := kneu.NewMockApiClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)
apiClient := kneuMocks.NewApiClientInterface(t)

writer := mocks.NewWriterInterface(t)

Expand Down Expand Up @@ -240,8 +241,8 @@ func TestCompleteAuth(t *testing.T) {
userId := uint(999)
studentId := uint(123)

oauthClient := kneu.NewMockOauthClientInterface(t)
apiClient := kneu.NewMockApiClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)
apiClient := kneuMocks.NewApiClientInterface(t)

writer := mocks.NewWriterInterface(t)

Expand Down Expand Up @@ -327,7 +328,7 @@ func TestCompleteAuth(t *testing.T) {
clientUserId := "999"
code := "qwerty1234"

oauthClient := kneu.NewMockOauthClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)

tokenResponse := kneu.OauthTokenResponse{
AccessToken: "test-access-tokem",
Expand Down Expand Up @@ -383,8 +384,8 @@ func TestCompleteAuth(t *testing.T) {
code := "qwerty1234"
userId := uint(999)

oauthClient := kneu.NewMockOauthClientInterface(t)
apiClient := kneu.NewMockApiClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)
apiClient := kneuMocks.NewApiClientInterface(t)

tokenResponse := kneu.OauthTokenResponse{
AccessToken: "test-access-tokem",
Expand Down Expand Up @@ -455,8 +456,8 @@ func TestCompleteAuth(t *testing.T) {
finalRedirectUri := "http://example.com"
code := "qwerty1234"

oauthClient := kneu.NewMockOauthClientInterface(t)
apiClient := kneu.NewMockApiClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)
apiClient := kneuMocks.NewApiClientInterface(t)

tokenResponse := kneu.OauthTokenResponse{}

Expand Down Expand Up @@ -500,8 +501,8 @@ func TestCompleteAuth(t *testing.T) {
t.Run("error_wrong_state", func(t *testing.T) {
code := "qwerty1234"

oauthClient := kneu.NewMockOauthClientInterface(t)
apiClient := kneu.NewMockApiClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)
apiClient := kneuMocks.NewApiClientInterface(t)

tokenResponse := kneu.OauthTokenResponse{}

Expand Down Expand Up @@ -538,8 +539,8 @@ func TestCompleteAuth(t *testing.T) {
finalRedirectUri := "http://example.com"
code := "qwerty1234"

oauthClient := kneu.NewMockOauthClientInterface(t)
apiClient := kneu.NewMockApiClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)
apiClient := kneuMocks.NewApiClientInterface(t)

tokenResponse := kneu.OauthTokenResponse{}

Expand Down Expand Up @@ -592,8 +593,8 @@ func TestCompleteAuth(t *testing.T) {
code := "qwerty1234"
userId := uint(999)

oauthClient := kneu.NewMockOauthClientInterface(t)
apiClient := kneu.NewMockApiClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)
apiClient := kneuMocks.NewApiClientInterface(t)

tokenResponse := kneu.OauthTokenResponse{
AccessToken: "test-access-token",
Expand Down Expand Up @@ -654,8 +655,8 @@ func TestCompleteAuth(t *testing.T) {
studentId := uint(123)
userId := uint(999)

oauthClient := kneu.NewMockOauthClientInterface(t)
apiClient := kneu.NewMockApiClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)
apiClient := kneuMocks.NewApiClientInterface(t)
writer := mocks.NewWriterInterface(t)

tokenResponse := kneu.OauthTokenResponse{
Expand Down Expand Up @@ -746,7 +747,7 @@ func TestCompleteAuth(t *testing.T) {
clientUserId := "999"
code := "qwerty1234"

oauthClient := kneu.NewMockOauthClientInterface(t)
oauthClient := kneuMocks.NewOauthClientInterface(t)

tokenResponse := kneu.OauthTokenResponse{
AccessToken: "test-access-tokem",
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ go 1.23
require (
github.com/VictoriaMetrics/fastcache v1.12.2
github.com/VictoriaMetrics/metrics v1.35.1
github.com/berejant/go-kneu v0.1.7
github.com/berejant/go-kneu v0.1.8
github.com/gin-gonic/gin v1.10.0
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/joho/godotenv v1.5.1
github.com/kneu-messenger-pigeon/events v0.1.41
github.com/kneu-messenger-pigeon/events v0.1.42
github.com/kneu-messenger-pigeon/victoria-metrics-init v0.1.3
github.com/segmentio/kafka-go v0.4.47
github.com/stretchr/testify v1.9.0
Expand Down
Loading

0 comments on commit 6cabd3e

Please sign in to comment.