summaryrefslogtreecommitdiff
path: root/spec/upload_spec.lua
diff options
context:
space:
mode:
authorMike Vink <mike@pionative.com>2025-02-03 21:29:42 +0100
committerMike Vink <mike@pionative.com>2025-02-03 21:29:42 +0100
commit5155816b7b925dec5d5feb1568b1d7ceb00938b9 (patch)
treedeca28ea15e79f6f804c3d90d2ba757881638af5 /spec/upload_spec.lua
fetch tarballHEADmaster
Diffstat (limited to 'spec/upload_spec.lua')
-rw-r--r--spec/upload_spec.lua63
1 files changed, 63 insertions, 0 deletions
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua
new file mode 100644
index 0000000..cc0b606
--- /dev/null
+++ b/spec/upload_spec.lua
@@ -0,0 +1,63 @@
+local test_env = require("spec.util.test_env")
+local run = test_env.run
+local testing_paths = test_env.testing_paths
+
+describe("luarocks upload #integration", function()
+
+ describe("general tests", function()
+ before_each(function()
+ test_env.setup_specs(nil)
+ end)
+
+ it("with no flags/arguments", function()
+ assert.is_false(run.luarocks_bool("upload"))
+ end)
+
+ it("invalid rockspec", function()
+ assert.is_false(run.luarocks_bool("upload invalid.rockspec"))
+ end)
+
+ it("api key invalid", function()
+ assert.is_false(run.luarocks_bool("upload --api-key=invalid invalid.rockspec"))
+ end)
+
+ it("api key invalid and skip-pack", function()
+ assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack " .. testing_paths.testing_server .. "/luasocket-${LUASOCKET}.rockspec"))
+ end)
+
+ it("force #unix", function()
+ assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force " .. testing_paths.testing_server .. "/luasocket-${LUASOCKET}.rockspec"))
+ end)
+ end)
+
+ describe("tests with Xavante server #mock", function()
+ lazy_setup(function()
+ test_env.setup_specs(nil, "mock")
+ test_env.mock_server_init()
+ end)
+
+ lazy_teardown(test_env.mock_server_done)
+
+ it("rockspec with api-key", function()
+ assert.is_true(run.luarocks_bool("upload " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. test_env.openssl_dirs .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"}))
+ end)
+
+ it("#gpg rockspec with --sign", function()
+ os.remove(testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec.asc")
+ os.remove(testing_paths.testrun_dir .. "/a_rock-1.0-1.src.rock.asc")
+ print(run.luarocks("upload " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. test_env.openssl_dirs .. " --api-key=123 --sign", {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"}))
+ end)
+
+ it("with .rockspec and .src.rock", function()
+ assert.is_true(run.luarocks_bool("upload " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.src.rock " .. test_env.openssl_dirs, {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"}))
+ end)
+
+ it("with arguments .src.rock and .rockspec out of order", function()
+ assert.is_false(run.luarocks_bool("upload " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.src.rock " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. test_env.openssl_dirs, {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"}))
+ end)
+
+ it("rockspec with api-key and skip-pack", function()
+ assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.fixtures_dir .. "/a_rock-1.0-1.rockspec " .. test_env.openssl_dirs .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testrun_dir .. "/luarocks_site.lua"}))
+ end)
+ end)
+end)