test

package
v0.0.0-...-3509efe Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FakeURL const to be used in tests
	FakeURL = "http://gilab.local"
	// FakeToken const
	FakeToken = "aaa-bbb-ccc-x0"
	// FakeSonarqubeSecret const
	FakeSonarqubeSecret = "aaaaa-wwwww-ssss"
)

Variables

View Source
var (
	// GetGitlabCalls int
	GetGitlabCalls int
	// GitlabPostCommentCalls int
	GitlabPostCommentCalls int
	// TestBadJSON string
	TestBadJSON = `{"serverUrl":"http://sonar.local", error`
	// TestValidJSON string
	TestValidJSON = `` /* 1380-byte string literal not displayed */

	// TestValidJSONComplete string
	TestValidJSONComplete = `` /* 1470-byte string literal not displayed */

	// TestValidJSONFake string
	TestValidJSONFake = `` /* 1465-byte string literal not displayed */

	// TestValidJSONFakeInvalid string
	TestValidJSONFakeInvalid = `` /* 1489-byte string literal not displayed */

	// TestValidJSONWithProperties string
	TestValidJSONWithProperties = `` /* 1575-byte string literal not displayed */

	// TestValidJSONWithoutProperties string
	TestValidJSONWithoutProperties = `` /* 1433-byte string literal not displayed */

	// TestValidJSONWithInvalidProjectID string
	TestValidJSONWithInvalidProjectID = `` /* 1577-byte string literal not displayed */

	// TestValidJSONWithUnknownProjectID string
	TestValidJSONWithUnknownProjectID = `` /* 1439-byte string literal not displayed */

	// TestValidJSONWithDuplicateProject string
	TestValidJSONWithDuplicateProject = `` /* 1415-byte string literal not displayed */

)

Functions

func InitMockLogger

func InitMockLogger() appcontext.Component

InitMockLogger func creates a mock logger interface

func Initclient

func Initclient() appcontext.Component

Initclient func returns a RepositoryMock interface

Types

type MockLogger

type MockLogger struct {
	//Logger only supports structured logging (less features more performance)
	Logger *zap.Logger
	//Sugar supports structured and printf-style APIs (less performance more features)
	Sugar *zap.SugaredLogger
}

MockLogger wrapper with two Logger methods

func (MockLogger) DPanic

func (logger MockLogger) DPanic(args ...interface{})

DPanic uses fmt.Sprint to construct and log a message. In development, the logger then panics. (See DPanicLevel for details.)

func (MockLogger) DPanicf

func (logger MockLogger) DPanicf(template string, args ...interface{})

DPanicf uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)

func (MockLogger) Debug

func (logger MockLogger) Debug(args ...interface{})

Debug uses fmt.Sprint to construct and log a message.

func (MockLogger) Debugf

func (logger MockLogger) Debugf(template string, args ...interface{})

Debugf uses fmt.Sprintf to log a templated message.

func (MockLogger) Error

func (logger MockLogger) Error(args ...interface{})

Error uses fmt.Sprint to construct and log a message.

func (MockLogger) Errorf

func (logger MockLogger) Errorf(template string, args ...interface{})

Errorf uses fmt.Sprintf to log a templated message.

func (MockLogger) Fatal

func (logger MockLogger) Fatal(args ...interface{})

Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.

func (MockLogger) Fatalf

func (logger MockLogger) Fatalf(template string, args ...interface{})

Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.

func (MockLogger) Info

func (logger MockLogger) Info(args ...interface{})

Info uses fmt.Sprint to construct and log a message.

func (MockLogger) Infof

func (logger MockLogger) Infof(template string, args ...interface{})

Infof uses fmt.Sprintf to log a templated message.

func (MockLogger) Panic

func (logger MockLogger) Panic(args ...interface{})

Panic uses fmt.Sprint to construct and log a message, then panics.

func (MockLogger) Panicf

func (logger MockLogger) Panicf(template string, args ...interface{})

Panicf uses fmt.Sprintf to log a templated message, then panics.

func (MockLogger) Sync

func (logger MockLogger) Sync()

Sync flushes the log if needed

func (MockLogger) Warn

func (logger MockLogger) Warn(args ...interface{})

Warn uses fmt.Sprint to construct and log a message.

func (MockLogger) Warnf

func (logger MockLogger) Warnf(template string, args ...interface{})

Warnf uses fmt.Sprintf to log a templated message.

type RepositoryMock

type RepositoryMock struct {
}

RepositoryMock struct is used for Mock Repository requests

func (RepositoryMock) GetGitlab

func (repo RepositoryMock) GetGitlab(gitlabURL, gitlabToken string) ([]byte, string, error)

GetGitlab func Mock

func (RepositoryMock) GitlabPostComment

func (repo RepositoryMock) GitlabPostComment(url string, params map[string]string) error

GitlabPostComment func mock

Jump to

Keyboard shortcuts

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