-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_delete_test.go
55 lines (49 loc) · 2.15 KB
/
test_delete_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"testing"
curl "github.com/cdwiegand/go-curling/context"
curltestharness "github.com/cdwiegand/go-curling/tests"
)
func Test_Delete_CurlContext(t *testing.T) {
testRun := curltestharness.BuildTestRun(t)
testRun.ContextBuilder = func(testrun *curltestharness.TestRun) *curl.CurlContext {
return &curl.CurlContext{
Urls: []string{"https://httpbin.org/delete"},
HttpVerb: "DELETE",
BodyOutput: testrun.EnsureAtLeastOneOutputFiles(),
}
}
testRun.SuccessHandler = func(json map[string]interface{}, testrun *curltestharness.TestRun) {
// no error means success, it's delete, there's no real response other than a success code
}
testRun.RunTestRun()
}
func Test_Delete_CmdLine(t *testing.T) {
testRun := curltestharness.BuildTestRun(t)
testRun.CmdLineBuilder = func(testrun *curltestharness.TestRun) []string {
return []string{"https://httpbin.org/delete", "-X", "DELETE", "-o", testrun.GetOneOutputFile()}
}
testRun.SuccessHandler = func(json map[string]interface{}, testrun *curltestharness.TestRun) {
// no error means success, it's delete, there's no real response other than a success code
}
testRun.RunTestRun()
testRun = curltestharness.BuildTestRun(t)
testRun.CmdLineBuilder = func(testrun *curltestharness.TestRun) []string {
return []string{"https://httpbin.org/delete", "--request", "DELETE", "-o", testrun.GetOneOutputFile()}
}
testRun.SuccessHandler = func(json map[string]interface{}, testrun *curltestharness.TestRun) {
// no error means success, it's delete, there's no real response other than a success code
}
testRun.RunTestRun()
}
/* -- now part of normal Test_Delete_CmdLine using wsl in Windows!
func Test_Delete_CmdLine_ExplicitCurl(t *testing.T) {
testRun := curltestharness.BuildTestRun(t)
testRun.CmdLineBuilder = func(testrun *curltestharness.TestRun) []string {
return []string{"https://httpbin.org/delete", "-X", "DELETE", "-o", testrun.GetOneOutputFile()}
}
testRun.SuccessHandler = func(json map[string]interface{}, testrun *curltestharness.TestRun) {
// no error means success, it's delete, there's no real response other than a success code
}
testRun.RunTestRunAgainstCurlCli()
}*/