Initial commit on Forgejo
Fresh repository history for elektrine/tarakan-client hosted at https://git.elektrine.com/elektrine/tarakan-client.
This commit is contained in:
commit
58b29a7f84
70 changed files with 12994 additions and 0 deletions
25
cmd/tarakan/config_flags_test.go
Normal file
25
cmd/tarakan/config_flags_test.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestPeelAPIFlags(t *testing.T) {
|
||||
url, token, rest := peelAPIFlags([]string{
|
||||
"--token", "secret", "report", "--agent", "grok", "--url", "http://localhost:4000", "--pickup",
|
||||
})
|
||||
if url != "http://localhost:4000" || token != "secret" {
|
||||
t.Fatalf("url=%q token=%q", url, token)
|
||||
}
|
||||
if len(rest) != 4 || rest[0] != "report" || rest[3] != "--pickup" {
|
||||
t.Fatalf("rest = %#v", rest)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveAPIFlagURL(t *testing.T) {
|
||||
got, err := resolveAPIFlagURL("", "https://tarakan.lol")
|
||||
if err != nil || got != "https://tarakan.lol" {
|
||||
t.Fatalf("got %q err %v", got, err)
|
||||
}
|
||||
if _, err := resolveAPIFlagURL("https://a", "https://b"); err == nil {
|
||||
t.Fatal("expected disagreement error")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue