File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -29,3 +29,42 @@ teardown(){
29
29
run eval " $COMMAND "
30
30
[ " $status " -eq 0 ]
31
31
}
32
+
33
+ @test " Command with custom headers" {
34
+ HEADERS=' {"Content-Type": "application/json"}'
35
+ COMMAND=" $API_TO_GO --headers '$HEADERS ' $BASE_URL /todos/1"
36
+ run eval " $COMMAND "
37
+ [ " $status " -eq 0 ]
38
+ }
39
+
40
+ @test " Command with POST method" {
41
+ DATA=' {"title": "foo", "body": "bar", "userId": 1}'
42
+ COMMAND=" $API_TO_GO --method POST $BASE_URL /posts '$DATA '"
43
+ run eval " $COMMAND "
44
+ [ " $status " -eq 0 ]
45
+ }
46
+
47
+ @test " Command with GET method" {
48
+ COMMAND=" $API_TO_GO --method GET $BASE_URL /posts/1"
49
+ run eval " $COMMAND "
50
+ [ " $status " -eq 0 ]
51
+ }
52
+
53
+ @test " Debug mode activation" {
54
+ COMMAND=" $API_TO_GO -D $BASE_URL /posts"
55
+ run eval " $COMMAND "
56
+ [ " $status " -eq 0 ]
57
+ }
58
+
59
+ @test " Display help message" {
60
+ COMMAND=" $API_TO_GO --help"
61
+ run eval " $COMMAND "
62
+ [ " $status " -eq 0 ]
63
+ [ " ${lines[0]} " = " Usage: api-to-go [options] <url> [body]" ]
64
+ }
65
+
66
+ @test " Display version information" {
67
+ COMMAND=" $API_TO_GO --version"
68
+ run eval " $COMMAND "
69
+ [ " $status " -eq 0 ]
70
+ }
You can’t perform that action at this time.
0 commit comments