Commit 7cad12f77f223e72a05a3cf79a793b69dd9c0b87
1 parent
a00c534c
Exists in
master
and in
4 other branches
Added more tests for archive api
Change-Id: I2b0752bc2593a944d42dde0ffe0ef9ce408228a5
Showing
1 changed file
with
9 additions
and
0 deletions
Show diff stats
spec/requests/api/repositories_spec.rb
@@ -229,6 +229,15 @@ describe API::API do | @@ -229,6 +229,15 @@ describe API::API do | ||
229 | it "should get the archive" do | 229 | it "should get the archive" do |
230 | get api("/projects/#{project.id}/repository/archive", user) | 230 | get api("/projects/#{project.id}/repository/archive", user) |
231 | response.status.should == 200 | 231 | response.status.should == 200 |
232 | + response.content_type.should == 'application/x-gzip' | ||
233 | + storage_path = Rails.root.join("tmp", "repositories") | ||
234 | + file_path = project.repository.archive_repo(nil, storage_path) | ||
235 | + file_path_compare = file_path + 'compare' | ||
236 | + File.open(file_path_compare,'wb'){|f|f.write(response.body)} | ||
237 | + FileUtils.compare_file(file_path, file_path_compare).should be_true | ||
238 | + #cleanup | ||
239 | + File.delete(file_path) | ||
240 | + File.delete(file_path_compare) | ||
232 | end | 241 | end |
233 | 242 | ||
234 | it "should return 404 for invalid sha" do | 243 | it "should return 404 for invalid sha" do |