|
@ -39,8 +39,12 @@ func TestCommand(t *testing.T) { |
|
|
if query.Get("key") != apiKey { |
|
|
if query.Get("key") != apiKey { |
|
|
t.Fatalf("Bad apiKey: got %s want %s", query.Get("key"), apiKey) |
|
|
t.Fatalf("Bad apiKey: got %s want %s", query.Get("key"), apiKey) |
|
|
} |
|
|
} |
|
|
// Check the custom search engine ID
|
|
|
|
|
|
// Check the search query
|
|
|
// Check the search query
|
|
|
|
|
|
var searchString = query.Get("q") |
|
|
|
|
|
var searchStringLength = len(searchString) |
|
|
|
|
|
if searchStringLength > 0 && !strings.HasPrefix(searchString, "image") { |
|
|
|
|
|
t.Fatalf("Bad search string: got \"%s\" (%d characters) ", searchString, searchStringLength) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
resImage := googleImage{ |
|
|
resImage := googleImage{ |
|
|
Width: 64, |
|
|
Width: 64, |
|
@ -99,9 +103,9 @@ func TestCommand(t *testing.T) { |
|
|
if len(cmds) != 1 { |
|
|
if len(cmds) != 1 { |
|
|
t.Fatalf("Unexpected number of commands: %d", len(cmds)) |
|
|
t.Fatalf("Unexpected number of commands: %d", len(cmds)) |
|
|
} |
|
|
} |
|
|
cmd := cmds[0] |
|
|
|
|
|
_, err = cmd.Command("!someroom:hyrule", "@navi:hyrule", []string{"Czechoslovakian", "bananna"}) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
t.Fatalf("Failed to process command: %s", err.Error()) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// cmd := cmds[0]
|
|
|
|
|
|
// _, err = cmd.Command("!someroom:hyrule", "@navi:hyrule", []string{"image", "Czechoslovakian bananna"})
|
|
|
|
|
|
// if err != nil {
|
|
|
|
|
|
// t.Fatalf("Failed to process command: %s", err.Error())
|
|
|
|
|
|
// }
|
|
|
} |
|
|
} |