aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2017-10-08 01:31:21 -0300
committerHisham Muhammad <hisham@gobolinux.org>2017-10-08 01:31:21 -0300
commitfeedb79595885c8f86ad412ef561f05664da7c14 (patch)
tree49b94267e185c38eb5b7e89553776b7728aea624 /test
parentafcba75d2772e664b69698390c8000210b203175 (diff)
downloadluarocks-feedb79595885c8f86ad412ef561f05664da7c14.tar.gz
luarocks-feedb79595885c8f86ad412ef561f05664da7c14.tar.bz2
luarocks-feedb79595885c8f86ad412ef561f05664da7c14.zip
Tests: use local fixture for upload test.
Do not hit the github repository for LuaSocket in upload test.
Diffstat (limited to 'test')
-rw-r--r--test/mock-server.lua17
-rw-r--r--test/testfiles/a_rock-1.0-1.rockspec17
-rw-r--r--test/testfiles/a_rock.lua1
3 files changed, 35 insertions, 0 deletions
diff --git a/test/mock-server.lua b/test/mock-server.lua
index 797e2bc5..dbbdea2c 100644
--- a/test/mock-server.lua
+++ b/test/mock-server.lua
@@ -64,6 +64,23 @@ server:add_resource("/api/1/{id:[0-9]+}/upload_rock/{id:[0-9]+}", {
64 } 64 }
65}) 65})
66 66
67server:add_resource("/file/{name:[^/]+}", {
68 {
69 method = "GET",
70 path = "/",
71 produces = "text/plain",
72 handler = function(query, name)
73 local fd = io.open("test/testfiles/"..name, "r")
74 if not fd then
75 return restserver.response():status(404)
76 end
77 local data = fd:read("*a")
78 fd:close()
79 return restserver.response():status(200):entity(data)
80 end
81 }
82})
83
67-- SHUTDOWN this mock-server 84-- SHUTDOWN this mock-server
68server:add_resource("/shutdown", { 85server:add_resource("/shutdown", {
69 { 86 {
diff --git a/test/testfiles/a_rock-1.0-1.rockspec b/test/testfiles/a_rock-1.0-1.rockspec
new file mode 100644
index 00000000..9f15e87a
--- /dev/null
+++ b/test/testfiles/a_rock-1.0-1.rockspec
@@ -0,0 +1,17 @@
1package = "a_rock"
2version = "1.0-1"
3source = {
4 url = "http://localhost:8080/file/a_rock.lua"
5}
6description = {
7 summary = "An example rockspec",
8}
9dependencies = {
10 "lua >= 5.1"
11}
12build = {
13 type = "builtin",
14 modules = {
15 build = "a_rock.lua"
16 },
17}
diff --git a/test/testfiles/a_rock.lua b/test/testfiles/a_rock.lua
new file mode 100644
index 00000000..a5647075
--- /dev/null
+++ b/test/testfiles/a_rock.lua
@@ -0,0 +1 @@
return {}