MG-134 - Add support for Report templates (#180)

* initial implementation

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* initial implementation

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* add remove report from nats handler

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix failing linter

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* address comments

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* move runinfo to pkg

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* update report handler

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* update reports handler

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* update handler in reports

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* update go.mod and go.sum

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* update package to chromedp

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* change update reorts to use chromium

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* update report template

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* add endpoint and repo methods

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* add template validation

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* remove repeated code

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix failing linter

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix failing linter

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix template formatting

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* update report template

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix mocks and tests

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* remove debug logs

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix api docs

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* remove pointers

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix template path

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix template path

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* address comments

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix failing validation

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* address comments

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* failing linter

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix logic

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* address comments

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* revert ui variable changes

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* rename method

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* update to browserless service

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix failing linter

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* fix go mod file

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

* address comments

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>

---------

Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
This commit is contained in:
Steve Munene
2025-07-09 19:44:59 +03:00
committed by GitHub
parent 148e2fbb7f
commit 2e0432bdb5
26 changed files with 1491 additions and 389 deletions
+91
View File
@@ -0,0 +1,91 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
mock "github.com/stretchr/testify/mock"
)
// NewEmailer creates a new instance of Emailer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewEmailer(t interface {
mock.TestingT
Cleanup(func())
}) *Emailer {
mock := &Emailer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Emailer is an autogenerated mock type for the Emailer type
type Emailer struct {
mock.Mock
}
type Emailer_Expecter struct {
mock *mock.Mock
}
func (_m *Emailer) EXPECT() *Emailer_Expecter {
return &Emailer_Expecter{mock: &_m.Mock}
}
// SendEmailNotification provides a mock function for the type Emailer
func (_mock *Emailer) SendEmailNotification(to []string, from string, subject string, header string, user string, content string, footer string, attachments map[string][]byte) error {
ret := _mock.Called(to, from, subject, header, user, content, footer, attachments)
if len(ret) == 0 {
panic("no return value specified for SendEmailNotification")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func([]string, string, string, string, string, string, string, map[string][]byte) error); ok {
r0 = returnFunc(to, from, subject, header, user, content, footer, attachments)
} else {
r0 = ret.Error(0)
}
return r0
}
// Emailer_SendEmailNotification_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendEmailNotification'
type Emailer_SendEmailNotification_Call struct {
*mock.Call
}
// SendEmailNotification is a helper method to define mock.On call
// - to
// - from
// - subject
// - header
// - user
// - content
// - footer
// - attachments
func (_e *Emailer_Expecter) SendEmailNotification(to interface{}, from interface{}, subject interface{}, header interface{}, user interface{}, content interface{}, footer interface{}, attachments interface{}) *Emailer_SendEmailNotification_Call {
return &Emailer_SendEmailNotification_Call{Call: _e.mock.On("SendEmailNotification", to, from, subject, header, user, content, footer, attachments)}
}
func (_c *Emailer_SendEmailNotification_Call) Run(run func(to []string, from string, subject string, header string, user string, content string, footer string, attachments map[string][]byte)) *Emailer_SendEmailNotification_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].([]string), args[1].(string), args[2].(string), args[3].(string), args[4].(string), args[5].(string), args[6].(string), args[7].(map[string][]byte))
})
return _c
}
func (_c *Emailer_SendEmailNotification_Call) Return(err error) *Emailer_SendEmailNotification_Call {
_c.Call.Return(err)
return _c
}
func (_c *Emailer_SendEmailNotification_Call) RunAndReturn(run func(to []string, from string, subject string, header string, user string, content string, footer string, attachments map[string][]byte) error) *Emailer_SendEmailNotification_Call {
_c.Call.Return(run)
return _c
}
+120
View File
@@ -0,0 +1,120 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"time"
mock "github.com/stretchr/testify/mock"
)
// NewTicker creates a new instance of Ticker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewTicker(t interface {
mock.TestingT
Cleanup(func())
}) *Ticker {
mock := &Ticker{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// Ticker is an autogenerated mock type for the Ticker type
type Ticker struct {
mock.Mock
}
type Ticker_Expecter struct {
mock *mock.Mock
}
func (_m *Ticker) EXPECT() *Ticker_Expecter {
return &Ticker_Expecter{mock: &_m.Mock}
}
// Stop provides a mock function for the type Ticker
func (_mock *Ticker) Stop() {
_mock.Called()
return
}
// Ticker_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
type Ticker_Stop_Call struct {
*mock.Call
}
// Stop is a helper method to define mock.On call
func (_e *Ticker_Expecter) Stop() *Ticker_Stop_Call {
return &Ticker_Stop_Call{Call: _e.mock.On("Stop")}
}
func (_c *Ticker_Stop_Call) Run(run func()) *Ticker_Stop_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Ticker_Stop_Call) Return() *Ticker_Stop_Call {
_c.Call.Return()
return _c
}
func (_c *Ticker_Stop_Call) RunAndReturn(run func()) *Ticker_Stop_Call {
_c.Run(run)
return _c
}
// Tick provides a mock function for the type Ticker
func (_mock *Ticker) Tick() <-chan time.Time {
ret := _mock.Called()
if len(ret) == 0 {
panic("no return value specified for Tick")
}
var r0 <-chan time.Time
if returnFunc, ok := ret.Get(0).(func() <-chan time.Time); ok {
r0 = returnFunc()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(<-chan time.Time)
}
}
return r0
}
// Ticker_Tick_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Tick'
type Ticker_Tick_Call struct {
*mock.Call
}
// Tick is a helper method to define mock.On call
func (_e *Ticker_Expecter) Tick() *Ticker_Tick_Call {
return &Ticker_Tick_Call{Call: _e.mock.On("Tick")}
}
func (_c *Ticker_Tick_Call) Run(run func()) *Ticker_Tick_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *Ticker_Tick_Call) Return(timeCh <-chan time.Time) *Ticker_Tick_Call {
_c.Call.Return(timeCh)
return _c
}
func (_c *Ticker_Tick_Call) RunAndReturn(run func() <-chan time.Time) *Ticker_Tick_Call {
_c.Call.Return(run)
return _c
}