mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-27 13:08:30 +00:00
fix test compile
This commit is contained in:
parent
89e6298583
commit
4ae3cca6ac
3 changed files with 7 additions and 7 deletions
|
@ -82,9 +82,8 @@ func getCacheKey(remoteCommand, data string) string {
|
||||||
// The POST arguments are `cmd`, `args`, `channel`, and `scope`.
|
// The POST arguments are `cmd`, `args`, `channel`, and `scope`.
|
||||||
// The `scope` argument is required because no attempt is made to infer the scope from the command, unlike /cached_pub.
|
// The `scope` argument is required because no attempt is made to infer the scope from the command, unlike /cached_pub.
|
||||||
func HTTPBackendUncachedPublish(w http.ResponseWriter, r *http.Request) {
|
func HTTPBackendUncachedPublish(w http.ResponseWriter, r *http.Request) {
|
||||||
b := Backend
|
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
formData, err := b.UnsealRequest(r.Form)
|
formData, err := Backend.UnsealRequest(r.Form)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(403)
|
w.WriteHeader(403)
|
||||||
fmt.Fprintf(w, "Error: %v", err)
|
fmt.Fprintf(w, "Error: %v", err)
|
||||||
|
|
|
@ -12,19 +12,20 @@ func Test(t *testing.T) { TestingT(t) }
|
||||||
|
|
||||||
func TestSealRequest(t *testing.T) {
|
func TestSealRequest(t *testing.T) {
|
||||||
TSetup(SetupNoServers, nil)
|
TSetup(SetupNoServers, nil)
|
||||||
|
b := Backend
|
||||||
|
|
||||||
values := url.Values{
|
values := url.Values{
|
||||||
"QuickBrownFox": []string{"LazyDog"},
|
"QuickBrownFox": []string{"LazyDog"},
|
||||||
}
|
}
|
||||||
|
|
||||||
sealedValues, err := SealRequest(values)
|
sealedValues, err := b.SealRequest(values)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
// sealedValues.Encode()
|
// sealedValues.Encode()
|
||||||
// id=0&msg=KKtbng49dOLLyjeuX5AnXiEe6P0uZwgeP_7mMB5vhP-wMAAPZw%3D%3D&nonce=-wRbUnifscisWUvhm3gBEXHN5QzrfzgV
|
// id=0&msg=KKtbng49dOLLyjeuX5AnXiEe6P0uZwgeP_7mMB5vhP-wMAAPZw%3D%3D&nonce=-wRbUnifscisWUvhm3gBEXHN5QzrfzgV
|
||||||
|
|
||||||
unsealedValues, err := UnsealRequest(sealedValues)
|
unsealedValues, err := b.UnsealRequest(sealedValues)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ func (backend *TBackendRequestChecker) ServeHTTP(w http.ResponseWriter, r *http.
|
||||||
|
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
|
|
||||||
unsealedForm, err := UnsealRequest(r.PostForm)
|
unsealedForm, err := Backend.UnsealRequest(r.PostForm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
backend.tb.Errorf("Failed to unseal backend request: %v", err)
|
backend.tb.Errorf("Failed to unseal backend request: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ func TSealForSavePubMsg(tb testing.TB, cmd Command, channel string, arguments in
|
||||||
}
|
}
|
||||||
form.Set("time", strconv.FormatInt(time.Now().Unix(), 10))
|
form.Set("time", strconv.FormatInt(time.Now().Unix(), 10))
|
||||||
|
|
||||||
sealed, err := SealRequest(form)
|
sealed, err := Backend.SealRequest(form)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tb.Error(err)
|
tb.Error(err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -300,7 +300,7 @@ func TSealForUncachedPubMsg(tb testing.TB, cmd Command, channel string, argument
|
||||||
form.Set("time", time.Now().Format(time.UnixDate))
|
form.Set("time", time.Now().Format(time.UnixDate))
|
||||||
form.Set("scope", scope.String())
|
form.Set("scope", scope.String())
|
||||||
|
|
||||||
sealed, err := SealRequest(form)
|
sealed, err := Backend.SealRequest(form)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tb.Error(err)
|
tb.Error(err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue