aboutsummaryrefslogtreecommitdiff
path: root/spec/upload_spec.lua
blob: f0125966532f08461bc4f58f92da6d01bd582529 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
local test_env = require("test/test_environment")

test_env.unload_luarocks()

local extra_rocks = {
   "/lua-cjson-2.1.0-1.src.rock"
}

expose("LuaRocks upload tests #blackbox #b_upload", function()

   before_each(function()
      test_env.setup_specs(extra_rocks)
      run = test_env.run
   end)

   it("LuaRocks upload with no flags/arguments", function()
      assert.is_false(run.luarocks_bool("upload"))
   end)

   it("LuaRocks upload invalid rockspec", function()
      assert.is_false(run.luarocks_bool("upload invalid.rockspec"))
   end)
   
   it("LuaRocks upload api key invalid", function()
      assert.is_false(run.luarocks_bool("upload --api-key=invalid invalid.rockspec"))
   end)
   
   it("LuaRocks upload api key invalid and skip-pack", function()
      assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --skip-pack luacov-0.11.0-1.rockspec"))
   end)
   
   it("LuaRocks upload force", function()
      assert.is_true(run.luarocks_bool("install lua-cjson"))
      assert.is_false(run.luarocks_bool("upload --api-key=\"invalid\" --force luacov-0.11.0-1.rockspec"))
      assert.is_true(run.luarocks_bool("install lua-cjson"))
   end)
end)