mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-10-13 03:37:12 +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:
1 parent
5f42d4fe5f
commit
b3bbc0dadf
40 files changed
+1009
-101
No files matched your search
@@ -8,11 +8,16 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestExtractCookies(t *testing.T) {
|
||||
path := createTestDB(t, "Cookies", cookiesSchema,
|
||||
func setupCookieDB(t *testing.T) string {
|
||||
t.Helper()
|
||||
return createTestDB(t, "Cookies", cookiesSchema,
|
||||
insertCookie("session", ".old.com", "/", "", 13340000000000000, 13350000000000000, 1, 1),
|
||||
insertCookie("token", ".new.com", "/api", "", 13360000000000000, 13370000000000000, 1, 0),
|
||||
)
|
||||
}
|
||||
|
||||
func TestExtractCookies(t *testing.T) {
|
||||
path := setupCookieDB(t)
|
||||
|
||||
got, err := extractCookies(nil, path)
|
||||
require.NoError(t, err)
|
||||
@@ -34,6 +39,22 @@ func TestExtractCookies(t *testing.T) {
|
||||
assert.True(t, got[1].IsHTTPOnly)
|
||||
}
|
||||
|
||||
func TestCountCookies(t *testing.T) {
|
||||
path := setupCookieDB(t)
|
||||
|
||||
count, err := countCookies(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, count)
|
||||
}
|
||||
|
||||
func TestCountCookies_Empty(t *testing.T) {
|
||||
path := createTestDB(t, "Cookies", cookiesSchema)
|
||||
|
||||
count, err := countCookies(path)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 0, count)
|
||||
}
|
||||
|
||||
func TestStripCookieHash(t *testing.T) {
|
||||
googleHash := sha256.Sum256([]byte(".google.com"))
|
||||
shopifyHash := sha256.Sum256([]byte(".shopify.com"))
|
||||
|
||||
Reference in new issue
Block a user