diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2017-10-08 01:31:21 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2017-10-08 01:31:21 -0300 |
| commit | feedb79595885c8f86ad412ef561f05664da7c14 (patch) | |
| tree | 49b94267e185c38eb5b7e89553776b7728aea624 | |
| parent | afcba75d2772e664b69698390c8000210b203175 (diff) | |
| download | luarocks-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.
| -rw-r--r-- | spec/upload_spec.lua | 4 | ||||
| -rw-r--r-- | test/mock-server.lua | 17 | ||||
| -rw-r--r-- | test/testfiles/a_rock-1.0-1.rockspec | 17 | ||||
| -rw-r--r-- | test/testfiles/a_rock.lua | 1 |
4 files changed, 37 insertions, 2 deletions
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index 6ec8e302..4091bbc9 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua | |||
| @@ -60,10 +60,10 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() | |||
| 60 | end) | 60 | end) |
| 61 | 61 | ||
| 62 | it("LuaRocks upload rockspec with api-key", function() | 62 | it("LuaRocks upload rockspec with api-key", function() |
| 63 | assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) | 63 | assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_dir .. "/testfiles/a_rock-1.0-1.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) |
| 64 | end) | 64 | end) |
| 65 | it("LuaRocks upload rockspec with api-key and skip-pack", function() | 65 | it("LuaRocks upload rockspec with api-key and skip-pack", function() |
| 66 | assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) | 66 | assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_dir .. "/testfiles/a_rock-1.0-1.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) |
| 67 | end) | 67 | end) |
| 68 | end) | 68 | end) |
| 69 | end) | 69 | end) |
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 | ||
| 67 | server: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 |
| 68 | server:add_resource("/shutdown", { | 85 | server: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 @@ | |||
| 1 | package = "a_rock" | ||
| 2 | version = "1.0-1" | ||
| 3 | source = { | ||
| 4 | url = "http://localhost:8080/file/a_rock.lua" | ||
| 5 | } | ||
| 6 | description = { | ||
| 7 | summary = "An example rockspec", | ||
| 8 | } | ||
| 9 | dependencies = { | ||
| 10 | "lua >= 5.1" | ||
| 11 | } | ||
| 12 | build = { | ||
| 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 {} | |||
