aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2017-10-08 01:57:17 -0300
committerHisham Muhammad <hisham@gobolinux.org>2017-10-08 01:57:17 -0300
commitc5bcb900a8245845dd5cd4fd8bf796591769bbee (patch)
tree5698699bfa3a2ae778324852249d0eeca8719d3e /spec
parentfeedb79595885c8f86ad412ef561f05664da7c14 (diff)
downloadluarocks-c5bcb900a8245845dd5cd4fd8bf796591769bbee.tar.gz
luarocks-c5bcb900a8245845dd5cd4fd8bf796591769bbee.tar.bz2
luarocks-c5bcb900a8245845dd5cd4fd8bf796591769bbee.zip
Tests: use local fixture for new_version test.
Diffstat (limited to 'spec')
-rw-r--r--spec/new_version_spec.lua13
-rw-r--r--spec/upload_spec.lua29
2 files changed, 12 insertions, 30 deletions
diff --git a/spec/new_version_spec.lua b/spec/new_version_spec.lua
index c4185b1d..6b2e2147 100644
--- a/spec/new_version_spec.lua
+++ b/spec/new_version_spec.lua
@@ -1,14 +1,15 @@
1local test_env = require("test/test_environment") 1local test_env = require("test/test_environment")
2local test_mock_server = require("test/test_mock_server")
2local lfs = require("lfs") 3local lfs = require("lfs")
3local run = test_env.run 4local run = test_env.run
4local testing_paths = test_env.testing_paths 5local testing_paths = test_env.testing_paths
5 6
6test_env.unload_luarocks() 7test_env.unload_luarocks()
7 8
8local extra_rocks = { 9local extra_rocks = test_mock_server.extra_rocks({
9 "/abelhas-1.0-1.rockspec", 10 "/abelhas-1.0-1.rockspec",
10 "/lpeg-0.12-1.rockspec" 11 "/lpeg-0.12-1.rockspec"
11} 12})
12 13
13describe("LuaRocks new_version tests #blackbox #b_new_version", function() 14describe("LuaRocks new_version tests #blackbox #b_new_version", function()
14 15
@@ -37,10 +38,12 @@ describe("LuaRocks new_version tests #blackbox #b_new_version", function()
37 38
38 describe("LuaRocks new_version more complex tests", function() 39 describe("LuaRocks new_version more complex tests", function()
39 it("LuaRocks new version with remote spec", function() 40 it("LuaRocks new version with remote spec", function()
40 assert.is_true(run.luarocks_bool("new_version https://luarocks.org/manifests/luarocks/luasocket-2.0.2-6.rockspec")) 41 test_mock_server.init()
41 assert.is.truthy(lfs.attributes("luasocket-2.0.2-6.rockspec")) 42 assert.is_true(run.luarocks_bool("new_version http://localhost:8080/file/a_rock-1.0-1.rockspec"))
42 assert.is.truthy(lfs.attributes("luasocket-2.0.2-7.rockspec")) 43 assert.is.truthy(lfs.attributes("a_rock-1.0-1.rockspec"))
44 assert.is.truthy(lfs.attributes("a_rock-1.0-2.rockspec"))
43 test_env.remove_files(lfs.currentdir(), "luasocket--") 45 test_env.remove_files(lfs.currentdir(), "luasocket--")
46 test_mock_server.done()
44 end) 47 end)
45 48
46 it("LuaRocks new_version of luacov", function() 49 it("LuaRocks new_version of luacov", function()
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua
index 4091bbc9..cf915eb3 100644
--- a/spec/upload_spec.lua
+++ b/spec/upload_spec.lua
@@ -1,25 +1,11 @@
1local test_env = require("test/test_environment") 1local test_env = require("test/test_environment")
2local test_mock_server = require("test/test_mock_server")
2local run = test_env.run 3local run = test_env.run
3local testing_paths = test_env.testing_paths 4local testing_paths = test_env.testing_paths
4 5
5test_env.unload_luarocks() 6test_env.unload_luarocks()
6 7
7local extra_rocks = { 8local extra_rocks = test_mock_server.extra_rocks()
8 -- rocks needed for mock-server
9 "/copas-2.0.1-1.src.rock",
10 "/coxpcall-1.16.0-1.src.rock",
11 "/dkjson-2.5-2.src.rock",
12 "/luafilesystem-1.6.3-1.src.rock",
13 "/luasec-0.6-1.rockspec",
14 "/luasocket-3.0rc1-2.src.rock",
15 "/luasocket-3.0rc1-2.rockspec",
16 "/restserver-0.1-1.src.rock",
17 "/restserver-xavante-0.2-1.src.rock",
18 "/rings-1.3.0-1.src.rock",
19 "/wsapi-1.6.1-1.src.rock",
20 "/wsapi-xavante-1.6.1-1.src.rock",
21 "/xavante-2.4.0-1.src.rock"
22}
23 9
24describe("LuaRocks upload tests #blackbox #b_upload", function() 10describe("LuaRocks upload tests #blackbox #b_upload", function()
25 11
@@ -49,15 +35,9 @@ describe("LuaRocks upload tests #blackbox #b_upload", function()
49 end) 35 end)
50 36
51 describe("LuaRocks upload tests with Xavante server #mock", function() 37 describe("LuaRocks upload tests with Xavante server #mock", function()
52 before_each(function() 38 before_each(test_mock_server.init)
53 assert.is_true(test_env.need_rock("restserver-xavante"))
54 local final_command = test_env.execute_helper(testing_paths.lua .. " " .. testing_paths.testing_dir .. "/mock-server.lua &", true, test_env.env_variables)
55 os.execute(final_command)
56 end)
57 39
58 after_each(function() 40 after_each(test_mock_server.done)
59 os.execute("curl localhost:8080/shutdown")
60 end)
61 41
62 it("LuaRocks upload rockspec with api-key", function() 42 it("LuaRocks upload rockspec with api-key", function()
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"})) 43 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"}))
@@ -68,4 +48,3 @@ describe("LuaRocks upload tests #blackbox #b_upload", function()
68 end) 48 end)
69end) 49end)
70 50
71