File tree Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,43 @@ func TestRun(t *testing.T) {
36
36
require .NoError (t , utils .InitConfig (utils.InitParams {
37
37
ProjectId : projectRef ,
38
38
}, fsys ))
39
-
40
- // Set project reference in flags
41
39
flags .ProjectRef = projectRef
42
40
41
+ // Mock all API requests
42
+ defer gock .OffAll ()
43
+
44
+ // Mock API keys
45
+ gock .New (utils .DefaultApiHost ).
46
+ Get ("/v1/projects/" + projectRef + "/api-keys" ).
47
+ Reply (200 ).
48
+ JSON ([]map [string ]string {{"name" : "anon" , "api_key" : "test-key" }})
49
+
50
+ // Mock database version
51
+ gock .New (utils .DefaultApiHost ).
52
+ Get ("/v1/projects" ).
53
+ Reply (200 ).
54
+ JSON ([]map [string ]interface {}{
55
+ {
56
+ "id" : projectRef ,
57
+ "database" : map [string ]string {"version" : "1.0.0" },
58
+ },
59
+ })
60
+
61
+ // Mock auth version
62
+ gock .New ("https://" + utils .GetSupabaseHost (projectRef )).
63
+ Get ("/auth/v1/health" ).
64
+ Reply (200 ).
65
+ JSON (map [string ]string {"version" : "2.0.0" })
66
+
67
+ // Mock postgrest version
68
+ gock .New ("https://" + utils .GetSupabaseHost (projectRef )).
69
+ Get ("/rest/v1/" ).
70
+ Reply (200 ).
71
+ JSON (map [string ]interface {}{
72
+ "swagger" : "2.0" ,
73
+ "info" : map [string ]string {"version" : "3.0.0" },
74
+ })
75
+
43
76
// Execute: Call the Run function
44
77
err := Run (context .Background (), fsys )
45
78
You can’t perform that action at this time.
0 commit comments