mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-25 17:53:24 +01:00
formatted
This commit is contained in:
parent
1065fff062
commit
c48c4dc83f
@ -99,7 +99,7 @@ func query(query string) {
|
||||
func displayBannerIfSet() error {
|
||||
config, err := lib.GetConfig()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get config: %v", err)
|
||||
return fmt.Errorf("failed to get config: %v", err)
|
||||
}
|
||||
url := lib.GetServerHostname() + "/api/v1/banner?commit_hash=" + GitCommit + "&device_id=" + config.DeviceId + "&forced_banner=" + os.Getenv("FORCED_BANNER")
|
||||
resp, err := http.Get(url)
|
||||
@ -156,4 +156,3 @@ func export() {
|
||||
fmt.Println(entry)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,13 +2,13 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os/exec"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"strings"
|
||||
"testing"
|
||||
"fmt"
|
||||
|
||||
"github.com/ddworken/hishtory/shared"
|
||||
)
|
||||
@ -50,7 +50,7 @@ func TestIntegrationWithNewDevice(t *testing.T) {
|
||||
gvm use go1.17
|
||||
cd /home/david/code/hishtory/
|
||||
go build -o /tmp/client client/client.go
|
||||
/tmp/client install ` + userSecret)
|
||||
/tmp/client install `+userSecret)
|
||||
match, err := regexp.MatchString(`Setting secret hishtory key to .*`, out)
|
||||
shared.Check(t, err)
|
||||
if !match {
|
||||
@ -131,7 +131,7 @@ func TestIntegrationWithNewDevice(t *testing.T) {
|
||||
t.Fatalf("output has `echo mynewercommand` the wrong number of times")
|
||||
}
|
||||
|
||||
// TODO: Test the live update flow
|
||||
// Manually submit an event that is tied to the second user, and then we'll check if we see it for the third user
|
||||
}
|
||||
|
||||
func testIntegration(t *testing.T) string {
|
||||
@ -156,7 +156,7 @@ func testIntegration(t *testing.T) string {
|
||||
t.Fatalf("status command has unexpected output: %#v", out)
|
||||
}
|
||||
|
||||
// Test the banner
|
||||
// Test the banner
|
||||
os.Setenv("FORCED_BANNER", "HELLO_FROM_SERVER")
|
||||
out = RunInteractiveBashCommands(t, `hishtory query`)
|
||||
if !strings.Contains(out, "HELLO_FROM_SERVER") {
|
||||
|
@ -20,8 +20,8 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/google/uuid"
|
||||
@ -123,7 +123,7 @@ func Setup(args []string) error {
|
||||
}
|
||||
fmt.Println("Setting secret hishtory key to " + string(userSecret))
|
||||
|
||||
// Create and set the config
|
||||
// Create and set the config
|
||||
var config ClientConfig
|
||||
config.UserSecret = userSecret
|
||||
config.IsEnabled = true
|
||||
@ -133,7 +133,7 @@ func Setup(args []string) error {
|
||||
return fmt.Errorf("failed to persist config to disk: %v", err)
|
||||
}
|
||||
|
||||
// Drop all existing data
|
||||
// Drop all existing data
|
||||
db, err := OpenLocalSqliteDb()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open DB: %v", err)
|
||||
|
@ -71,7 +71,6 @@ func TestGetUserSecret(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func TestPersist(t *testing.T) {
|
||||
defer shared.BackupAndRestore(t)()
|
||||
db, err := OpenLocalSqliteDb()
|
||||
@ -114,4 +113,4 @@ func TestSearch(t *testing.T) {
|
||||
if !shared.EntryEquals(*results[1], entry1) {
|
||||
t.Fatalf("Search()[0]=%#v, expected: %#v", results[1], entry1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user