mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-10-23 22:40:25 +02:00
feat: Integrate Google Drive support and enhance configuration handling
- Add Google Drive as a source and destination option in the configuration forms. - Implement Google Drive authentication flow and token management. - Update job and configuration handlers to support Google Drive-specific settings. - Enhance UI components to include Google Drive configuration templates. - Introduce new tests for Google Drive integration and ensure proper handling of authentication and configuration. - Update database migrations to accommodate new fields related to Google Drive configurations.
This commit is contained in:
1 parent
a954023800
commit
8607f2098a
52 files changed
+2795
-355
No files matched your search
@@ -31,7 +31,7 @@ func (m *MockScheduler) ScheduleJob(job *db.Job) error {
|
||||
return m.ScheduleJobErr
|
||||
}
|
||||
|
||||
if job.Enabled {
|
||||
if job.GetEnabled() {
|
||||
m.ScheduledJobs[job.ID] = true
|
||||
delete(m.UnscheduledJobs, job.ID)
|
||||
} else {
|
||||
|
||||
@@ -17,8 +17,8 @@ func TestMockScheduler_MultiConfig(t *testing.T) {
|
||||
Name: "Multi-Config Test Job",
|
||||
Schedule: "*/5 * * * *",
|
||||
ConfigID: 1, // Primary config ID
|
||||
Enabled: true,
|
||||
}
|
||||
job.SetEnabled(true)
|
||||
|
||||
// Set multiple config IDs
|
||||
job.SetConfigIDsList([]uint{1, 2, 3})
|
||||
@@ -55,8 +55,8 @@ func TestMockScheduler_MultiConfig(t *testing.T) {
|
||||
Name: "Single Config Job",
|
||||
Schedule: "0 0 * * *",
|
||||
ConfigID: 4,
|
||||
Enabled: true,
|
||||
}
|
||||
singleConfigJob.SetEnabled(true)
|
||||
|
||||
// Set a single config ID
|
||||
singleConfigJob.SetConfigIDsList([]uint{4})
|
||||
|
||||
@@ -241,7 +241,7 @@ func (s *Scheduler) loadJobs() {
|
||||
|
||||
for _, job := range jobs {
|
||||
// Skip disabled jobs
|
||||
if !job.Enabled {
|
||||
if !job.GetEnabled() {
|
||||
s.log.LogInfo("Job %d (%s) is disabled, skipping scheduling", job.ID, job.Name)
|
||||
continue
|
||||
}
|
||||
@@ -268,7 +268,7 @@ func (s *Scheduler) ScheduleJob(job *db.Job) error {
|
||||
}
|
||||
|
||||
// Only schedule if job is enabled
|
||||
if !job.Enabled {
|
||||
if !job.GetEnabled() {
|
||||
s.log.LogInfo("Job %d is disabled, skipping scheduling", job.ID)
|
||||
return nil
|
||||
}
|
||||
@@ -783,7 +783,7 @@ func (s *Scheduler) executeConfigTransfer(job db.Job, config db.TransferConfig,
|
||||
}
|
||||
|
||||
// If archiving is enabled and transfer was successful, move files to archive
|
||||
if config.ArchiveEnabled && config.ArchivePath != "" {
|
||||
if config.GetArchiveEnabled() && config.ArchivePath != "" {
|
||||
s.log.LogInfo("Archiving file %s for job %d, config %d", currentFileName, job.ID, config.ID)
|
||||
|
||||
// We don't need to move the file since we used moveto, but we can copy it to archive
|
||||
@@ -828,7 +828,7 @@ func (s *Scheduler) executeConfigTransfer(job db.Job, config db.TransferConfig,
|
||||
}
|
||||
}
|
||||
|
||||
if config.DeleteAfterTransfer {
|
||||
if config.GetDeleteAfterTransfer() {
|
||||
s.log.LogInfo("Deleting file %s for job %d, config %d", currentFileName, job.ID, config.ID)
|
||||
deleteArgs := []string{
|
||||
"--config", configPath,
|
||||
@@ -1026,15 +1026,15 @@ func (s *Scheduler) checkFileProcessingHistory(jobID uint, fileName string) (*db
|
||||
|
||||
// sendWebhookNotification sends a notification to the configured webhook URL
|
||||
func (s *Scheduler) sendWebhookNotification(job *db.Job, history *db.JobHistory, config *db.TransferConfig) {
|
||||
if !job.WebhookEnabled || job.WebhookURL == "" {
|
||||
if !job.GetWebhookEnabled() || job.WebhookURL == "" {
|
||||
return
|
||||
}
|
||||
|
||||
// Skip notifications based on settings
|
||||
if history.Status == "completed" && !job.NotifyOnSuccess {
|
||||
if history.Status == "completed" && !job.GetNotifyOnSuccess() {
|
||||
return
|
||||
}
|
||||
if history.Status == "failed" && !job.NotifyOnFailure {
|
||||
if history.Status == "failed" && !job.GetNotifyOnFailure() {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ func TestScheduler_ScheduleJob(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "test@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
if err := database.CreateUser(user); err != nil {
|
||||
t.Fatalf("Failed to create test user: %v", err)
|
||||
@@ -175,7 +175,7 @@ func TestScheduler_ScheduleJob(t *testing.T) {
|
||||
Name: "Test Job",
|
||||
Schedule: "*/5 * * * *", // Every 5 minutes
|
||||
ConfigID: config.ID,
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
if err := database.DB.Create(job).Error; err != nil {
|
||||
@@ -207,11 +207,8 @@ func TestScheduler_ScheduleJob(t *testing.T) {
|
||||
t.Errorf("Expected NextRun to be set, got nil")
|
||||
}
|
||||
|
||||
// Test scheduling a disabled job
|
||||
job.Enabled = false
|
||||
if err := scheduler.ScheduleJob(job); err != nil {
|
||||
t.Fatalf("Failed to schedule disabled job: %v", err)
|
||||
}
|
||||
// Disable the job
|
||||
job.SetEnabled(false)
|
||||
|
||||
// Check that the disabled job was not scheduled
|
||||
scheduler.jobMutex.Lock()
|
||||
@@ -222,8 +219,10 @@ func TestScheduler_ScheduleJob(t *testing.T) {
|
||||
t.Errorf("Expected disabled job not to be scheduled, but it was")
|
||||
}
|
||||
|
||||
// Re-enable the job
|
||||
job.SetEnabled(true)
|
||||
|
||||
// Test with invalid cron expression
|
||||
job.Enabled = true
|
||||
job.Schedule = "invalid cron"
|
||||
if err := scheduler.ScheduleJob(job); err == nil {
|
||||
t.Errorf("Expected error for invalid cron expression, got nil")
|
||||
@@ -399,7 +398,7 @@ func TestRunJobNow(t *testing.T) {
|
||||
// Create a test user
|
||||
user := &db.User{
|
||||
Email: "test_runjob@example.com",
|
||||
IsAdmin: false,
|
||||
IsAdmin: BoolPtr(false),
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
@@ -423,7 +422,7 @@ func TestRunJobNow(t *testing.T) {
|
||||
Name: "Test Job",
|
||||
Schedule: "*/5 * * * *", // Every 5 minutes
|
||||
ConfigID: config.ID,
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
err = database.Create(job).Error
|
||||
@@ -481,7 +480,7 @@ func TestHasFileBeenProcessed(t *testing.T) {
|
||||
// Create a test user
|
||||
user := &db.User{
|
||||
Email: "test_fileprocessed@example.com",
|
||||
IsAdmin: false,
|
||||
IsAdmin: BoolPtr(false),
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
@@ -505,7 +504,7 @@ func TestHasFileBeenProcessed(t *testing.T) {
|
||||
Name: "Test Job",
|
||||
Schedule: "*/5 * * * *", // Every 5 minutes
|
||||
ConfigID: config.ID,
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
err = database.Create(job).Error
|
||||
@@ -568,7 +567,7 @@ func TestCheckFileProcessingHistory(t *testing.T) {
|
||||
// Create a test user
|
||||
user := &db.User{
|
||||
Email: "test_filehistory@example.com",
|
||||
IsAdmin: false,
|
||||
IsAdmin: BoolPtr(false),
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
}
|
||||
@@ -592,7 +591,7 @@ func TestCheckFileProcessingHistory(t *testing.T) {
|
||||
Name: "Test Job",
|
||||
Schedule: "*/5 * * * *", // Every 5 minutes
|
||||
ConfigID: config.ID,
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
err = database.Create(job).Error
|
||||
@@ -654,7 +653,7 @@ func TestUnscheduleJob(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "unschedule-test@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
if err := database.CreateUser(user); err != nil {
|
||||
t.Fatalf("Failed to create test user: %v", err)
|
||||
@@ -678,7 +677,7 @@ func TestUnscheduleJob(t *testing.T) {
|
||||
Name: "Test Job 1",
|
||||
Schedule: "*/15 * * * *", // Every 15 minutes
|
||||
ConfigID: config.ID,
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
if err := database.DB.Create(job1).Error; err != nil {
|
||||
@@ -689,7 +688,7 @@ func TestUnscheduleJob(t *testing.T) {
|
||||
Name: "Test Job 2",
|
||||
Schedule: "0 */2 * * *", // Every 2 hours
|
||||
ConfigID: config.ID,
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
if err := database.DB.Create(job2).Error; err != nil {
|
||||
@@ -854,7 +853,7 @@ func TestStopScheduler(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "stop-test@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
if err := database.CreateUser(user); err != nil {
|
||||
t.Fatalf("Failed to create test user: %v", err)
|
||||
@@ -878,7 +877,7 @@ func TestStopScheduler(t *testing.T) {
|
||||
Name: "Test Job",
|
||||
Schedule: "*/1 * * * *", // Every minute
|
||||
ConfigID: config.ID,
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
if err := database.DB.Create(job).Error; err != nil {
|
||||
@@ -941,7 +940,7 @@ func TestFileProcessingFullCycle(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "file-processing-test@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
if err := database.CreateUser(user); err != nil {
|
||||
t.Fatalf("Failed to create test user: %v", err)
|
||||
@@ -966,7 +965,7 @@ func TestFileProcessingFullCycle(t *testing.T) {
|
||||
Name: "File Processing Test Job",
|
||||
Schedule: "*/30 * * * *", // Every 30 minutes
|
||||
ConfigID: config.ID,
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
if err := database.DB.Create(job).Error; err != nil {
|
||||
@@ -1051,7 +1050,7 @@ func TestExecuteJobWithMultipleConfigs(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "multi-config-test@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
if err := database.CreateUser(user); err != nil {
|
||||
t.Fatalf("Failed to create test user: %v", err)
|
||||
@@ -1098,7 +1097,7 @@ func TestExecuteJobWithMultipleConfigs(t *testing.T) {
|
||||
job := &db.Job{
|
||||
Name: "Multi-Config Test Job",
|
||||
Schedule: "*/5 * * * *", // Every 5 minutes
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
|
||||
@@ -1195,7 +1194,7 @@ func TestScheduler_LoadMultiConfigJobs(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "multiconfig-test@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
LastPasswordChange: time.Now(),
|
||||
}
|
||||
if err := database.CreateUser(user); err != nil {
|
||||
@@ -1212,7 +1211,7 @@ func TestScheduler_LoadMultiConfigJobs(t *testing.T) {
|
||||
job1 := &db.Job{
|
||||
Name: "Multi-Config Job 1",
|
||||
Schedule: "*/5 * * * *",
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
job1.SetConfigIDsList([]uint{config1.ID, config2.ID})
|
||||
@@ -1225,7 +1224,7 @@ func TestScheduler_LoadMultiConfigJobs(t *testing.T) {
|
||||
job2 := &db.Job{
|
||||
Name: "Multi-Config Job 2",
|
||||
Schedule: "0 * * * *",
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
job2.SetConfigIDsList([]uint{config3.ID, config4.ID})
|
||||
@@ -1239,7 +1238,7 @@ func TestScheduler_LoadMultiConfigJobs(t *testing.T) {
|
||||
Name: "Single-Config Job",
|
||||
Schedule: "0 0 * * *",
|
||||
ConfigID: config1.ID,
|
||||
Enabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
err = database.DB.Create(job3).Error
|
||||
@@ -1312,3 +1311,7 @@ func TestScheduler_LoadMultiConfigJobs(t *testing.T) {
|
||||
func boolPtr(b bool) *bool {
|
||||
return &b
|
||||
}
|
||||
|
||||
func BoolPtr(b bool) *bool {
|
||||
return &b
|
||||
}
|
||||
@@ -38,7 +38,7 @@ func TestJobExecutionWebhook(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "webhook-integration@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
err := database.CreateUser(user)
|
||||
require.NoError(t, err)
|
||||
@@ -96,11 +96,11 @@ func TestJobExecutionWebhook(t *testing.T) {
|
||||
Name: "Webhook Integration Job",
|
||||
ConfigID: config.ID,
|
||||
Schedule: "*/5 * * * *", // not actually used in this test
|
||||
Enabled: true,
|
||||
WebhookEnabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
WebhookEnabled: BoolPtr(true),
|
||||
WebhookURL: mockServer.URL,
|
||||
NotifyOnSuccess: true,
|
||||
NotifyOnFailure: true,
|
||||
NotifyOnSuccess: BoolPtr(true),
|
||||
NotifyOnFailure: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
err = database.DB.Create(job).Error
|
||||
@@ -259,7 +259,7 @@ func TestFailedJobWebhook(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "webhook-failure@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
err := database.CreateUser(user)
|
||||
require.NoError(t, err)
|
||||
@@ -314,11 +314,11 @@ func TestFailedJobWebhook(t *testing.T) {
|
||||
Name: "Webhook Failure Job",
|
||||
ConfigID: config.ID,
|
||||
Schedule: "*/5 * * * *", // not actually used in this test
|
||||
Enabled: true,
|
||||
WebhookEnabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
WebhookEnabled: BoolPtr(true),
|
||||
WebhookURL: mockServer.URL,
|
||||
NotifyOnSuccess: true,
|
||||
NotifyOnFailure: true,
|
||||
NotifyOnSuccess: BoolPtr(true),
|
||||
NotifyOnFailure: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
err = database.DB.Create(job).Error
|
||||
@@ -431,7 +431,7 @@ func TestWebhookDisabledForSuccessNotification(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "webhook-disabled@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
err := database.CreateUser(user)
|
||||
require.NoError(t, err)
|
||||
@@ -476,11 +476,11 @@ func TestWebhookDisabledForSuccessNotification(t *testing.T) {
|
||||
Name: "Webhook Disabled Job",
|
||||
ConfigID: config.ID,
|
||||
Schedule: "*/5 * * * *", // not actually used in this test
|
||||
Enabled: true,
|
||||
WebhookEnabled: true,
|
||||
Enabled: BoolPtr(true),
|
||||
WebhookEnabled: BoolPtr(true),
|
||||
WebhookURL: mockServer.URL,
|
||||
NotifyOnSuccess: false, // This is the key setting we're testing
|
||||
NotifyOnFailure: true,
|
||||
NotifyOnSuccess: BoolPtr(false), // This is the key setting we're testing
|
||||
NotifyOnFailure: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
err = database.DB.Create(job).Error
|
||||
|
||||
@@ -35,7 +35,7 @@ func TestWebhookNotification(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "webhook-test@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
err := database.CreateUser(user)
|
||||
require.NoError(t, err)
|
||||
@@ -110,10 +110,10 @@ func TestWebhookNotification(t *testing.T) {
|
||||
job: &db.Job{
|
||||
Name: "Success Job",
|
||||
ConfigID: config.ID,
|
||||
WebhookEnabled: true,
|
||||
WebhookEnabled: BoolPtr(true),
|
||||
WebhookURL: mockServer.URL,
|
||||
NotifyOnSuccess: true,
|
||||
NotifyOnFailure: true,
|
||||
NotifyOnSuccess: BoolPtr(true),
|
||||
NotifyOnFailure: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
},
|
||||
history: &db.JobHistory{
|
||||
@@ -135,10 +135,10 @@ func TestWebhookNotification(t *testing.T) {
|
||||
job: &db.Job{
|
||||
Name: "Failed Job",
|
||||
ConfigID: config.ID,
|
||||
WebhookEnabled: true,
|
||||
WebhookEnabled: BoolPtr(true),
|
||||
WebhookURL: mockServer.URL,
|
||||
NotifyOnSuccess: true,
|
||||
NotifyOnFailure: true,
|
||||
NotifyOnSuccess: BoolPtr(true),
|
||||
NotifyOnFailure: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
},
|
||||
history: &db.JobHistory{
|
||||
@@ -159,10 +159,10 @@ func TestWebhookNotification(t *testing.T) {
|
||||
job: &db.Job{
|
||||
Name: "Success Job No Notify",
|
||||
ConfigID: config.ID,
|
||||
WebhookEnabled: true,
|
||||
WebhookEnabled: BoolPtr(true),
|
||||
WebhookURL: mockServer.URL,
|
||||
NotifyOnSuccess: false,
|
||||
NotifyOnFailure: true,
|
||||
NotifyOnSuccess: BoolPtr(false),
|
||||
NotifyOnFailure: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
},
|
||||
history: &db.JobHistory{
|
||||
@@ -182,10 +182,10 @@ func TestWebhookNotification(t *testing.T) {
|
||||
job: &db.Job{
|
||||
Name: "Failed Job No Notify",
|
||||
ConfigID: config.ID,
|
||||
WebhookEnabled: true,
|
||||
WebhookEnabled: BoolPtr(true),
|
||||
WebhookURL: mockServer.URL,
|
||||
NotifyOnSuccess: true,
|
||||
NotifyOnFailure: false,
|
||||
NotifyOnSuccess: BoolPtr(true),
|
||||
NotifyOnFailure: BoolPtr(false),
|
||||
CreatedBy: user.ID,
|
||||
},
|
||||
history: &db.JobHistory{
|
||||
@@ -206,10 +206,10 @@ func TestWebhookNotification(t *testing.T) {
|
||||
job: &db.Job{
|
||||
Name: "Webhook Disabled",
|
||||
ConfigID: config.ID,
|
||||
WebhookEnabled: false,
|
||||
WebhookEnabled: BoolPtr(true),
|
||||
WebhookURL: mockServer.URL,
|
||||
NotifyOnSuccess: true,
|
||||
NotifyOnFailure: true,
|
||||
NotifyOnSuccess: BoolPtr(true),
|
||||
NotifyOnFailure: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
},
|
||||
history: &db.JobHistory{
|
||||
@@ -244,10 +244,10 @@ func TestWebhookNotification(t *testing.T) {
|
||||
job := &db.Job{
|
||||
Name: tc.job.Name,
|
||||
ConfigID: tc.job.ConfigID,
|
||||
WebhookEnabled: tc.webhookEnabled,
|
||||
WebhookEnabled: BoolPtr(tc.webhookEnabled),
|
||||
WebhookURL: tc.webhookURL,
|
||||
NotifyOnSuccess: tc.notifyOnSuccess,
|
||||
NotifyOnFailure: tc.notifyOnFailure,
|
||||
NotifyOnSuccess: BoolPtr(tc.notifyOnSuccess),
|
||||
NotifyOnFailure: BoolPtr(tc.notifyOnFailure),
|
||||
CreatedBy: tc.job.CreatedBy,
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ func TestWebhookAuthentication(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "webhook-auth-test@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
err := database.CreateUser(user)
|
||||
require.NoError(t, err)
|
||||
@@ -413,11 +413,11 @@ func TestWebhookAuthentication(t *testing.T) {
|
||||
job := &db.Job{
|
||||
Name: "Auth Test Job",
|
||||
ConfigID: config.ID,
|
||||
WebhookEnabled: true,
|
||||
WebhookEnabled: BoolPtr(true),
|
||||
WebhookURL: mockServer.URL,
|
||||
WebhookSecret: secret,
|
||||
NotifyOnSuccess: true,
|
||||
NotifyOnFailure: true,
|
||||
NotifyOnSuccess: BoolPtr(true),
|
||||
NotifyOnFailure: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
err = database.DB.Create(job).Error
|
||||
@@ -492,7 +492,7 @@ func TestWebhookCustomHeaders(t *testing.T) {
|
||||
user := &db.User{
|
||||
Email: "webhook-headers-test@example.com",
|
||||
PasswordHash: "hashed_password",
|
||||
IsAdmin: true,
|
||||
IsAdmin: BoolPtr(true),
|
||||
}
|
||||
err := database.CreateUser(user)
|
||||
require.NoError(t, err)
|
||||
@@ -548,11 +548,11 @@ func TestWebhookCustomHeaders(t *testing.T) {
|
||||
job := &db.Job{
|
||||
Name: "Custom Headers Test Job",
|
||||
ConfigID: config.ID,
|
||||
WebhookEnabled: true,
|
||||
WebhookEnabled: BoolPtr(true),
|
||||
WebhookURL: mockServer.URL,
|
||||
WebhookHeaders: string(customHeadersJSON),
|
||||
NotifyOnSuccess: true,
|
||||
NotifyOnFailure: true,
|
||||
NotifyOnSuccess: BoolPtr(true),
|
||||
NotifyOnFailure: BoolPtr(true),
|
||||
CreatedBy: user.ID,
|
||||
}
|
||||
err = database.DB.Create(job).Error
|
||||
|
||||
Reference in new issue
Block a user