service

package
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package service is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserNotFound is returned when user is not found.
	ErrUserNotFound = errors.New("user not found")

	// ErrBadResponse is returned when VK API returns bad response.
	ErrBadResponse = errors.New("bad response")
)

Functions

This section is empty.

Types

type MockVkClient

type MockVkClient struct {
	// contains filtered or unexported fields
}

MockVkClient is a mock of VkClient interface.

func NewMockVkClient

func NewMockVkClient(ctrl *gomock.Controller) *MockVkClient

NewMockVkClient creates a new mock instance.

func (*MockVkClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockVkClient) GroupsBan

func (m *MockVkClient) GroupsBan(params api.Params) (int, error)

GroupsBan mocks base method.

func (*MockVkClient) UsersGet

func (m *MockVkClient) UsersGet(params api.Params) (api.UsersGetResponse, error)

UsersGet mocks base method.

func (*MockVkClient) WallDeleteComment

func (m *MockVkClient) WallDeleteComment(params api.Params) (int, error)

WallDeleteComment mocks base method.

type MockVkClientMockRecorder

type MockVkClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockVkClientMockRecorder is the mock recorder for MockVkClient.

func (*MockVkClientMockRecorder) GroupsBan

func (mr *MockVkClientMockRecorder) GroupsBan(params interface{}) *gomock.Call

GroupsBan indicates an expected call of GroupsBan.

func (*MockVkClientMockRecorder) UsersGet

func (mr *MockVkClientMockRecorder) UsersGet(params interface{}) *gomock.Call

UsersGet indicates an expected call of UsersGet.

func (*MockVkClientMockRecorder) WallDeleteComment

func (mr *MockVkClientMockRecorder) WallDeleteComment(params interface{}) *gomock.Call

WallDeleteComment indicates an expected call of WallDeleteComment.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is a banhammer service.

func NewService

func NewService(logger *zap.Logger, client VkClient, heuristicRules entity.HeuristicRules) *Service

NewService creates a new banhammer service.

func (*Service) CheckComment

func (s *Service) CheckComment(comment *entity.Comment) (entity.BanReason, error)

CheckComment checks comment and ban user if needed.

type VkClient

type VkClient interface {
	UsersGet(params api.Params) (api.UsersGetResponse, error)
	GroupsBan(params api.Params) (int, error)
	WallDeleteComment(params api.Params) (int, error)
}

VkClient is a VK API client. It is used to mock VK API client in tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL