diff options
Diffstat (limited to 'spec/upload_spec.lua')
| -rw-r--r-- | spec/upload_spec.lua | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index 119d34b6..cc0b606c 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua | |||
| @@ -2,38 +2,41 @@ local test_env = require("spec.util.test_env") | |||
| 2 | local run = test_env.run | 2 | local run = test_env.run |
| 3 | local testing_paths = test_env.testing_paths | 3 | local testing_paths = test_env.testing_paths |
| 4 | 4 | ||
| 5 | test_env.unload_luarocks() | ||
| 6 | |||
| 7 | describe("luarocks upload #integration", function() | 5 | describe("luarocks upload #integration", function() |
| 8 | 6 | ||
| 9 | before_each(function() | 7 | describe("general tests", function() |
| 10 | test_env.setup_specs() | 8 | before_each(function() |
| 11 | end) | 9 | test_env.setup_specs(nil) |
| 10 | end) | ||
| 12 | 11 | ||
| 13 | it("with no flags/arguments", function() | 12 | it("with no flags/arguments", function() |
| 14 | assert.is_false(run.luarocks_bool("upload")) | 13 | assert.is_false(run.luarocks_bool("upload")) |
| 15 | end) | 14 | end) |
| 16 | 15 | ||
| 17 | it("invalid rockspec", function() | 16 | it("invalid rockspec", function() |
| 18 | assert.is_false(run.luarocks_bool("upload invalid.rockspec")) | 17 | assert.is_false(run.luarocks_bool("upload invalid.rockspec")) |
| 19 | end) | 18 | end) |
| 20 | 19 | ||
| 21 | it("api key invalid", function() | 20 | it("api key invalid", function() |
| 22 | assert.is_false(run.luarocks_bool("upload --api-key=invalid invalid.rockspec")) | 21 | assert.is_false(run.luarocks_bool("upload --api-key=invalid invalid.rockspec")) |
| 23 | end) | 22 | end) |
| 24 | 23 | ||
| 25 | it("api key invalid and skip-pack", function() | 24 | it("api key invalid and skip-pack", function() |
| 26 | assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack " .. testing_paths.testing_server .. "/luasocket-${LUASOCKET}.rockspec")) | 25 | assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack " .. testing_paths.testing_server .. "/luasocket-${LUASOCKET}.rockspec")) |
| 27 | end) | 26 | end) |
| 28 | 27 | ||
| 29 | it("force #unix", function() | 28 | it("force #unix", function() |
| 30 | assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force " .. testing_paths.testing_server .. "/luasocket-${LUASOCKET}.rockspec")) | 29 | assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force " .. testing_paths.testing_server .. "/luasocket-${LUASOCKET}.rockspec")) |
| 30 | end) | ||
| 31 | end) | 31 | end) |
| 32 | 32 | ||
| 33 | describe("tests with Xavante server #mock", function() | 33 | describe("tests with Xavante server #mock", function() |
| 34 | before_each(test_env.mock_server_init) | 34 | lazy_setup(function() |
| 35 | test_env.setup_specs(nil, "mock") | ||
| 36 | test_env.mock_server_init() | ||
| 37 | end) | ||
| 35 | 38 | ||
| 36 | after_each(test_env.mock_server_done) | 39 | lazy_teardown(test_env.mock_server_done) |
| 37 | 40 | ||
| 38 | it("rockspec with api-key", function() | 41 | it("rockspec with api-key", function() |
| 39 | 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"})) | 42 | 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"})) |
