mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-07-06 21:37:47 +02:00
feat: add CountEntries to skip decryption for list --detail (#562)
* feat: add CountEntries to skip decryption for list --detail (#549) * test: add CountEntries and countCategory tests at browser level * fix: address review feedback on CountRows and countLocalStorage * test: add CountRows unit tests
This commit is contained in:
@@ -7,11 +7,16 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestExtractPasswords(t *testing.T) {
|
||||
path := createTestDB(t, "Login Data", loginsSchema,
|
||||
func setupLoginDB(t *testing.T) string {
|
||||
t.Helper()
|
||||
return createTestDB(t, "Login Data", loginsSchema,
|
||||
insertLogin("https://old.com", "https://old.com/login", "alice", "", 13340000000000000),
|
||||
insertLogin("https://new.com", "https://new.com/login", "bob", "", 13360000000000000),
|
||||
)
|
||||
}
|
||||
|
||||
func TestExtractPasswords(t *testing.T) {
|
||||
path := setupLoginDB(t)
|
||||
|
||||
got, err := extractPasswords(nil, path)
|
||||
require.NoError(t, err)
|
||||
@@ -28,6 +33,22 @@ func TestExtractPasswords(t *testing.T) {
|
||||
assert.Empty(t, got[0].Password)
|
||||
}
|
||||
|
||||
func TestCountPasswords(t *testing.T) {
|
||||
path := setupLoginDB(t)
|
||||
|
||||
count, err := countPasswords(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, count)
|
||||
}
|
||||
|
||||
func TestCountPasswords_Empty(t *testing.T) {
|
||||
path := createTestDB(t, "Login Data", loginsSchema)
|
||||
|
||||
count, err := countPasswords(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 0, count)
|
||||
}
|
||||
|
||||
func TestExtractYandexPasswords(t *testing.T) {
|
||||
path := createTestDB(t, "Ya Passman Data", loginsSchema,
|
||||
insertLogin("https://origin.yandex.ru", "https://action.yandex.ru/submit", "user", "", 13350000000000000),
|
||||
|
||||
Reference in New Issue
Block a user