Project

General

Profile

Download (1.22 KB) Statistics
| Branch: | Tag: | Revision:

runcible / test / resources / role_test.rb @ master

1
require 'rubygems'
2
require 'minitest/autorun'
3

    
4
require './lib/runcible/resources/user'
5
require './lib/runcible/resources/role'
6

    
7
module Resources
8
  class TestRoles < MiniTest::Unit::TestCase
9
    def setup
10
      @username = 'integration_test_user'
11
      @role_name = 'super-users'
12
      @resource = TestRuncible.server.resources.role
13

    
14
      TestRuncible.server.resources.user.create(@username)
15
    end
16

    
17
    def teardown
18
      TestRuncible.server.resources.user.delete(@username)
19
    end
20

    
21
    def test_path_without_role_name
22
      path = @resource.class.path
23

    
24
      assert_match 'roles/', path
25
    end
26

    
27
    def test_path_with_role_name
28
      path = @resource.class.path(@role_name)
29

    
30
      assert_match "roles/#{@role_name}", path
31
    end
32

    
33
    def test_add
34
      skip 'TODO: should be removed when https://pulp.plan.io/issues/1078 is fixed'
35
      response = @resource.add(@role_name, @username)
36

    
37
      assert_equal 200, response.code
38
      @resource.remove(@role_name, @username)
39
    end
40

    
41
    def test_remove
42
      skip 'TODO: should be removed when https://pulp.plan.io/issues/1078 is fixed'
43
      @resource.add(@role_name, @username)
44
      response = @resource.remove(@role_name, @username)
45

    
46
      assert_equal 200, response.code
47
    end
48
  end
49
end