@@ -22,9 +22,9 @@ func TestGetDatabaseVersion(t *testing.T) {
2222 mockPostgres := api.V1ProjectWithDatabaseResponse {Id : projectRef }
2323 mockPostgres .Database .Version = "14.1.0.99"
2424 gock .New (utils .DefaultApiHost ).
25- Get ("/v1/projects" ).
25+ Get ("/v1/projects/" + projectRef ).
2626 Reply (http .StatusOK ).
27- JSON ([]api. V1ProjectWithDatabaseResponse { mockPostgres } )
27+ JSON (mockPostgres )
2828
2929 version , err := GetDatabaseVersion (context .Background (), projectRef )
3030
@@ -39,16 +39,13 @@ func TestGetDatabaseVersion(t *testing.T) {
3939
4040 defer gock .OffAll ()
4141 projectRef := apitest .RandomProjectRef ()
42- mockPostgres := api.V1ProjectWithDatabaseResponse {Id : "different-project" }
43- mockPostgres .Database .Version = "14.1.0.99"
4442 gock .New (utils .DefaultApiHost ).
45- Get ("/v1/projects" ).
46- Reply (http .StatusOK ).
47- JSON ([]api.V1ProjectWithDatabaseResponse {mockPostgres })
43+ Get ("/v1/projects/" + projectRef ).
44+ Reply (http .StatusNotFound )
4845
4946 version , err := GetDatabaseVersion (context .Background (), projectRef )
5047
51- assert .ErrorIs (t , err , errDatabaseVersion )
48+ assert .ErrorContains (t , err , "unexpected retrieve project status 404:" )
5249 assert .Empty (t , version )
5350 assert .Empty (t , apitest .ListUnmatchedRequests ())
5451 })
@@ -60,11 +57,9 @@ func TestGetDatabaseVersion(t *testing.T) {
6057 defer gock .OffAll ()
6158 projectRef := apitest .RandomProjectRef ()
6259 gock .New (utils .DefaultApiHost ).
63- Get ("/v1/projects" ).
60+ Get ("/v1/projects/" + projectRef ).
6461 Reply (http .StatusOK ).
65- JSON ([]api.V1ProjectWithDatabaseResponse {{
66- Id : projectRef ,
67- }})
62+ JSON (api.V1ProjectWithDatabaseResponse {Id : projectRef })
6863
6964 version , err := GetDatabaseVersion (context .Background (), projectRef )
7065
0 commit comments