@@ -69,9 +69,51 @@ module PlaceOS::Api
6969 end
7070 end
7171
72+ describe " GET /:id/commits" do
73+ context " interface" do
74+ pending " fetches the commits for a repository" do
75+ end
76+ end
77+
78+ context " driver" do
79+ repo = Model ::Generator .repository(type: :driver )
80+ repo.uri = " https://github.com/placeOS/private-drivers"
81+ repo.save!
82+
83+ it " fetches the commits for a repository" do
84+ id = repo.id.as(String )
85+ path = " #{ base } #{ id } /commits"
86+ result = curl(
87+ method: " GET" ,
88+ path: path,
89+ headers: authorization_header.merge({" Content-Type" => " application/json" }),
90+ )
91+
92+ result.status.should eq HTTP ::Status ::OK
93+ Array (String ).from_json(result.body).should_not be_empty
94+ end
95+
96+ it " fetches the commits for a file" do
97+ id = repo.id.as(String )
98+ params = HTTP ::Params {
99+ " driver" => " drivers/place/private_helper.cr" ,
100+ }
101+ path = " #{ base } #{ id } /commits?#{ params } "
102+ result = curl(
103+ method: " GET" ,
104+ path: path,
105+ headers: authorization_header.merge({" Content-Type" => " application/json" }),
106+ )
107+
108+ result.status.should eq HTTP ::Status ::OK
109+ Array (String ).from_json(result.body).should_not be_empty
110+ end
111+ end
112+ end
113+
72114 describe " driver only actions" do
73115 it " errors if enumerating drivers in an interface repo" do
74- repository = Model ::Generator .repository(type: Model :: Repository :: Type :: Interface ).save!
116+ repository = Model ::Generator .repository(type: :interface ).save!
75117
76118 id = repository.id.as(String )
77119 path = " #{ base } #{ id } /drivers"
0 commit comments