コード例 #1
0
ファイル: log_test.go プロジェクト: plietar/builder
func TestLogRepositoryFind(t *testing.T) {
	r := logRepository()
	bs := streams.NewBuildStream("abc123")
	buildLog, _ := r.CreateFromOutput(bs)

	timeStub := time.Now()
	buildLog.CreatedAt = timeStub
	buildLog.UpdatedAt = timeStub

	actual, err := r.FindByBuildID("abc123", "build")
	actual.CreatedAt = timeStub
	actual.UpdatedAt = timeStub

	assert.Nil(t, err)
	assert.Equal(t, buildLog, actual)
}
コード例 #2
0
ファイル: log_test.go プロジェクト: plietar/builder
func TestLogRepositoryCreatePushLog(t *testing.T) {
	r := logRepository()
	bs := streams.NewBuildStream("abc123")
	bs.PushOutput.Write([]byte("logged"))
	_, pushLog := r.CreateFromOutput(bs)

	timeStub := time.Now()
	pushLog.CreatedAt = timeStub
	pushLog.UpdatedAt = timeStub

	expected := &BuildLog{
		ID:        pushLog.ID,
		Type:      "push",
		BuildID:   "abc123",
		Data:      "logged",
		CreatedAt: timeStub,
		UpdatedAt: timeStub,
	}
	assert.Equal(t, expected, pushLog)
}