@@ -59,7 +59,19 @@ const ListOutput = `
5959 "parent_id": null,
6060 "tags": ["Red", "Team"],
6161 "test": "old"
62- },
62+ }
63+ ],
64+ "links": {
65+ "next": "%sprojects?limit=1&marker=1234",
66+ "self": "%sprojects?limit=1",
67+ "previous": null
68+ }
69+ }
70+ `
71+
72+ const ListOutputSecondPage = `
73+ {
74+ "projects": [
6375 {
6476 "is_domain": false,
6577 "description": "The team that is blue",
@@ -73,8 +85,21 @@ const ListOutput = `
7385 }
7486 }
7587 ],
88+ "links": {
89+ "next": "%sprojects?limit=1&marker=9876",
90+ "self": "%sprojects?limit=1&marker=1234",
91+ "previous": null
92+ }
93+ }
94+ `
95+
96+ const ListOutputThirdPage = `
97+ {
98+ "projects": [
99+ ],
76100 "links": {
77101 "next": null,
102+ "self": "%sprojects?limit=1&marker=9876",
78103 "previous": null
79104 }
80105}
@@ -299,7 +324,15 @@ func HandleListProjectsSuccessfully(t *testing.T, fakeServer th.FakeServer) {
299324
300325 w .Header ().Set ("Content-Type" , "application/json" )
301326 w .WriteHeader (http .StatusOK )
302- fmt .Fprint (w , ListOutput )
327+
328+ switch r .URL .Query ().Get ("marker" ) {
329+ case "" :
330+ fmt .Fprintf (w , ListOutput , fakeServer .Endpoint (), fakeServer .Endpoint ())
331+ case "1234" :
332+ fmt .Fprintf (w , ListOutputSecondPage , fakeServer .Endpoint (), fakeServer .Endpoint ())
333+ case "9876" :
334+ fmt .Fprintf (w , ListOutputThirdPage , fakeServer .Endpoint ())
335+ }
303336 })
304337}
305338
0 commit comments