Documentation
¶
Index ¶
- Variables
- func CreateBasicTestDB() *gokeepasslib.Database
- func DeepCopyEntry(original gokeepasslib.Entry) gokeepasslib.Entry
- func FindEntryInDB(db *gokeepasslib.Database, uuid gokeepasslib.UUID) *gokeepasslib.Entry
- func FindEntryInGroups(groups []gokeepasslib.Group, uuid gokeepasslib.UUID) *gokeepasslib.Entry
- func Start(kdbxPath string, debugMode bool, serverURL string)
- type ClearStatusMsg
- type DBOpenedMsg
- type DBSaveErrorMsg
- type DBSavedMsg
- type ErrMsg
- type LocalMetadataMsg
- type LoginError
- type LoginSuccessMsg
- type MockResponse
- type RegisterError
- type RegisterSuccessMsg
- type ScreenTestMockAPIClient
- func (m *ScreenTestMockAPIClient) DownloadVault(ctx context.Context) (io.ReadCloser, *models.VaultVersion, error)
- func (m *ScreenTestMockAPIClient) GetVaultMetadata(ctx context.Context) (*models.VaultVersion, error)
- func (m *ScreenTestMockAPIClient) ListVersions(ctx context.Context, limit, offset int) ([]models.VaultVersion, int64, error)
- func (m *ScreenTestMockAPIClient) Login(ctx context.Context, username, password string) (string, error)
- func (m *ScreenTestMockAPIClient) Register(ctx context.Context, username, password string) error
- func (m *ScreenTestMockAPIClient) RollbackToVersion(ctx context.Context, versionID int64) error
- func (m *ScreenTestMockAPIClient) SetAuthToken(token string)
- func (m *ScreenTestMockAPIClient) UploadVault(ctx context.Context, data io.Reader, size int64, contentModifiedAt time.Time) error
- type ScreenTestSuite
- func (s *ScreenTestSuite) AssertState(t *testing.T, expected screenState)
- func (s *ScreenTestSuite) AssertViewContains(t *testing.T, substring string)
- func (s *ScreenTestSuite) CaptureOutput(t *testing.T, cmds ...tea.Cmd) string
- func (s *ScreenTestSuite) CaptureView(t *testing.T, cmd tea.Cmd) string
- func (s *ScreenTestSuite) ExecuteCmd(_ context.Context, cmd tea.Cmd) tea.Msg
- func (s *ScreenTestSuite) RenderScreen() string
- func (s *ScreenTestSuite) SetupMockAPILogin(username, password string, response MockResponse) *ScreenTestSuite
- func (s *ScreenTestSuite) SetupMockAPIRegister(username, password string, response MockResponse) *ScreenTestSuite
- func (s *ScreenTestSuite) SimulateKeyPress(key tea.KeyType) (tea.Model, tea.Cmd)
- func (s *ScreenTestSuite) SimulateKeyRune(r rune) (tea.Model, tea.Cmd)
- func (s *ScreenTestSuite) WithAuthToken(token string) *ScreenTestSuite
- func (s *ScreenTestSuite) WithDatabase(db *gokeepasslib.Database) *ScreenTestSuite
- func (s *ScreenTestSuite) WithServerURL(url string) *ScreenTestSuite
- func (s *ScreenTestSuite) WithState(state screenState) *ScreenTestSuite
- type ServerMetadataMsg
- type SyncDownloadSuccessMsg
- type SyncError
- type SyncStartedMsg
- type SyncUploadSuccessMsg
Constants ¶
This section is empty.
Variables ¶
var ( OpenKdbxCmd = openKdbxCmd SaveKdbxCmd = saveKdbxCmd ClearStatusCmd = clearStatusCmd StartSyncCmd = startSyncCmd FetchServerMetadataCmd = fetchServerMetadataCmd )
Экспортируем функции-команды для тестирования.
Functions ¶
func CreateBasicTestDB ¶
func CreateBasicTestDB() *gokeepasslib.Database
CreateBasicTestDB создает простую тестовую базу данных.
func DeepCopyEntry ¶
func DeepCopyEntry(original gokeepasslib.Entry) gokeepasslib.Entry
DeepCopyEntry создает глубокую копию записи.
func FindEntryInDB ¶
func FindEntryInDB(db *gokeepasslib.Database, uuid gokeepasslib.UUID) *gokeepasslib.Entry
FindEntryInDB ищет запись по UUID в базе данных.
func FindEntryInGroups ¶
func FindEntryInGroups(groups []gokeepasslib.Group, uuid gokeepasslib.UUID) *gokeepasslib.Entry
FindEntryInGroups рекурсивно ищет запись по UUID.
Types ¶
type ClearStatusMsg ¶
type ClearStatusMsg struct{}
ClearStatusMsg сообщение для очистки статусного сообщения.
type DBOpenedMsg ¶
type DBOpenedMsg struct {
DB *gokeepasslib.Database
}
DBOpenedMsg сообщение об успешном открытии базы данных.
type DBSaveErrorMsg ¶
type DBSaveErrorMsg struct {
Err error
}
DBSaveErrorMsg сообщение об ошибке сохранения базы данных.
type LocalMetadataMsg ¶
LocalMetadataMsg содержит метаданные локального файла.
type LoginError ¶
type LoginError struct {
// contains filtered or unexported fields
}
func (LoginError) Error ¶
func (e LoginError) Error() string
type LoginSuccessMsg ¶
type LoginSuccessMsg struct {
Token string
}
LoginSuccessMsg сообщение об успешном входе.
type MockResponse ¶
MockResponse создает ответ для мока API клиента.
type RegisterError ¶
type RegisterError struct {
// contains filtered or unexported fields
}
func (RegisterError) Error ¶
func (e RegisterError) Error() string
type RegisterSuccessMsg ¶
type RegisterSuccessMsg struct{}
RegisterSuccessMsg сообщение об успешной регистрации.
type ScreenTestMockAPIClient ¶
ScreenTestMockAPIClient - мок для API клиента, реализующий интерфейс api.Client.
func (*ScreenTestMockAPIClient) DownloadVault ¶
func (m *ScreenTestMockAPIClient) DownloadVault(ctx context.Context) (io.ReadCloser, *models.VaultVersion, error)
DownloadVault мокирует метод DownloadVault.
func (*ScreenTestMockAPIClient) GetVaultMetadata ¶
func (m *ScreenTestMockAPIClient) GetVaultMetadata(ctx context.Context) (*models.VaultVersion, error)
GetVaultMetadata мокирует метод GetVaultMetadata.
func (*ScreenTestMockAPIClient) ListVersions ¶
func (m *ScreenTestMockAPIClient) ListVersions( ctx context.Context, limit, offset int, ) ([]models.VaultVersion, int64, error)
ListVersions мокирует метод ListVersions.
func (*ScreenTestMockAPIClient) Login ¶
func (m *ScreenTestMockAPIClient) Login(ctx context.Context, username, password string) (string, error)
Login мокирует метод Login.
func (*ScreenTestMockAPIClient) Register ¶
func (m *ScreenTestMockAPIClient) Register(ctx context.Context, username, password string) error
Register мокирует метод Register.
func (*ScreenTestMockAPIClient) RollbackToVersion ¶
func (m *ScreenTestMockAPIClient) RollbackToVersion(ctx context.Context, versionID int64) error
RollbackToVersion мокирует метод RollbackToVersion.
func (*ScreenTestMockAPIClient) SetAuthToken ¶
func (m *ScreenTestMockAPIClient) SetAuthToken(token string)
SetAuthToken мокирует метод SetAuthToken.
type ScreenTestSuite ¶
type ScreenTestSuite struct {
Model *model
Mocks struct {
APIClient *ScreenTestMockAPIClient
}
}
ScreenTestSuite содержит общую инфраструктуру для тестирования экранов.
func NewScreenTestSuite ¶
func NewScreenTestSuite() *ScreenTestSuite
NewScreenTestSuite создает новую тестовую среду для экранов.
func (*ScreenTestSuite) AssertState ¶
func (s *ScreenTestSuite) AssertState(t *testing.T, expected screenState)
AssertState проверяет, что состояние модели соответствует ожидаемому.
func (*ScreenTestSuite) AssertViewContains ¶
func (s *ScreenTestSuite) AssertViewContains(t *testing.T, substring string)
AssertViewContains проверяет, что View() модели содержит указанный текст.
func (*ScreenTestSuite) CaptureOutput ¶
CaptureOutput выполняет последовательность команд и возвращает финальный View.
func (*ScreenTestSuite) CaptureView ¶
CaptureView выполняет команду и возвращает результат View().
func (*ScreenTestSuite) ExecuteCmd ¶
ExecuteCmd выполняет команду и возвращает сообщение.
func (*ScreenTestSuite) RenderScreen ¶
func (s *ScreenTestSuite) RenderScreen() string
RenderScreen выполняет рендеринг View() для тестирования отображения.
func (*ScreenTestSuite) SetupMockAPILogin ¶
func (s *ScreenTestSuite) SetupMockAPILogin(username, password string, response MockResponse) *ScreenTestSuite
SetupMockAPILogin настраивает мок API клиента для метода Login.
func (*ScreenTestSuite) SetupMockAPIRegister ¶
func (s *ScreenTestSuite) SetupMockAPIRegister(username, password string, response MockResponse) *ScreenTestSuite
SetupMockAPIRegister настраивает мок API клиента для метода Register.
func (*ScreenTestSuite) SimulateKeyPress ¶
SimulateKeyPress симулирует нажатие клавиши.
func (*ScreenTestSuite) SimulateKeyRune ¶
SimulateKeyRune симулирует ввод символа.
func (*ScreenTestSuite) WithAuthToken ¶
func (s *ScreenTestSuite) WithAuthToken(token string) *ScreenTestSuite
WithAuthToken устанавливает токен авторизации в модели.
func (*ScreenTestSuite) WithDatabase ¶
func (s *ScreenTestSuite) WithDatabase(db *gokeepasslib.Database) *ScreenTestSuite
WithDatabase устанавливает базу данных в модели.
func (*ScreenTestSuite) WithServerURL ¶
func (s *ScreenTestSuite) WithServerURL(url string) *ScreenTestSuite
WithServerURL устанавливает URL сервера в модели.
func (*ScreenTestSuite) WithState ¶
func (s *ScreenTestSuite) WithState(state screenState) *ScreenTestSuite
WithState устанавливает состояние экрана в модели.
type ServerMetadataMsg ¶
type ServerMetadataMsg struct {
Metadata *models.VaultVersion
Found bool
}
ServerMetadataMsg содержит метаданные, полученные с сервера.
type SyncDownloadSuccessMsg ¶
type SyncDownloadSuccessMsg struct {
ReloadNeeded bool
}
SyncDownloadSuccessMsg сигнализирует об успешном скачивании.
type SyncError ¶
type SyncError struct {
// contains filtered or unexported fields
}
SyncError сообщает об ошибке во время процесса синхронизации.
type SyncUploadSuccessMsg ¶
type SyncUploadSuccessMsg struct{}
SyncUploadSuccessMsg сигнализирует об успешной загрузке.
Source Files
¶
- commands.go
- initialization.go
- input_helpers.go
- model.go
- screen_add.go
- screen_attachment_delete.go
- screen_attachment_input.go
- screen_credentials.go
- screen_detail.go
- screen_edit.go
- screen_list.go
- screen_login.go
- screen_login_register_choice.go
- screen_new_kdbx.go
- screen_password.go
- screen_register.go
- screen_server_url.go
- screen_sync.go
- screen_test_helpers.go
- screen_version.go
- screen_welcome.go
- test_helpers.go
- tui.go
- update.go
- utils.go