Skip to content

Commit 1b34471

Browse files
committed
test(api:repositories): test for commit listing
1 parent 6a9fd23 commit 1b34471

3 files changed

Lines changed: 46 additions & 4 deletions

File tree

shard.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ shards:
151151

152152
placeos-build:
153153
git: https://github.com/placeos/build.git
154-
version: 0.3.0+git.commit.0388aaece63a784c2692ed650ca471754421b99d
154+
version: 0.4.0
155155

156156
placeos-compiler:
157157
git: https://github.com/placeos/compiler.git

shard.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: placeos-rest-api
2-
version: 1.29.3
2+
version: 1.30.0
33
crystal: ~> 1
44

55
targets:
@@ -45,7 +45,7 @@ dependencies:
4545
# For build client
4646
placeos-build:
4747
github: placeos/build
48-
branch: feat/repositories/discovery
48+
version: ~> 0.4
4949

5050
# For core client
5151
placeos-core:

spec/repositories_spec.cr

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)