package service

import (
	"context"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

func TestResetPasswordViaDirect_MissingNamespace(t *testing.T) {
	t.Setenv("NAMESPACE", "")

	svc := &AgentService{}
	err := svc.resetPasswordViaDirect(context.Background(), "cluster-1", "root", "newpass", false)
	require.Error(t, err)
	assert.Contains(t, err.Error(), "NAMESPACE is empty")
}

func TestResetPasswordViaDirect_MissingNamespace_Worker(t *testing.T) {
	t.Setenv("NAMESPACE", "")

	svc := &AgentService{}
	err := svc.resetPasswordViaDirect(context.Background(), "cluster-1", "root", "newpass", true)
	require.Error(t, err)
	assert.Contains(t, err.Error(), "NAMESPACE is empty")
}
