|
3 | 3 | describe GitolitePublicKeysHelper do
|
4 | 4 | TEST_KEY = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCpOU1DzQzU4/acdt3wWhk43acGs3Jp7jVlnEtc+2C8QFAUiJMrAOzyUnEliwxarGonJ5gKbI9NkqqPpz9LATBQw382+3FjAlptgqn7eGBih0DgwN6wdHflTRdE6sRn7hxB5h50p547n26FpbX9GSOHPhgxSnyvGXnC+YZyTfMiw5JMhw68SfLS8YENrXukg2ItJPspn6mPqIHrcM2NJOG4Bm+1ibYpDfrWJqYp3Q6disgwrsN08pS6lDfoQRiRHXg8WFbQbHloVaYFpdT6VoBQiAydeSpDSYTBJd/v3qTpK8aheC8sdnrddZf1T6L51z7WZ6vPVKQYPjpAxZ4p6eef nicolas@tchoum'
|
5 | 5 |
|
6 |
| - before(:all) do |
7 |
| - @admin_user = create_admin_user |
8 |
| - @user_without_perm = create_anonymous_user |
9 |
| - @user_with_perm = create_user_with_permissions(FactoryBot.create(:project), permissions: [:create_repository_deployment_credentials]) |
10 |
| - @gitolite_public_key = create_ssh_key(user_id: @user_without_perm.id, key_type: 1, title: 'foo1', key: TEST_KEY) |
11 |
| - end |
12 |
| - |
13 |
| - describe '.keylabel' do |
14 |
| - context 'when current user is the key owner' do |
15 |
| - before { User.current = @user_without_perm } |
16 |
| - |
17 |
| - it { expect(helper.keylabel(@gitolite_public_key)).to eq 'foo1' } |
18 |
| - end |
19 |
| - |
20 |
| - context 'when current user is not the key owner' do |
21 |
| - before { User.current = @admin_user } |
22 |
| - |
23 |
| - it { expect(helper.keylabel(@gitolite_public_key)).to eq 'git_anonymous@foo1' } |
24 |
| - end |
25 |
| - end |
26 |
| - |
27 |
| - describe '.can_create_deployment_keys_for_some_project' do |
28 |
| - context 'when current user is admin' do |
29 |
| - it { expect(helper.can_create_deployment_keys_for_some_project(@admin_user)).to eq true } |
30 |
| - end |
31 |
| - |
32 |
| - context 'when current user can create_deployment_keys' do |
33 |
| - it { expect(helper.can_create_deployment_keys_for_some_project(@user_with_perm)).to eq true } |
34 |
| - end |
35 |
| - |
36 |
| - context 'when current user cannot create_deployment_keys' do |
37 |
| - it { expect(helper.can_create_deployment_keys_for_some_project(@user_without_perm)).to eq false } |
38 |
| - end |
39 |
| - end |
| 6 | + # before(:all) do |
| 7 | + # @admin_user = create_admin_user |
| 8 | + # @user_without_perm = create_anonymous_user |
| 9 | + # @user_with_perm = create_user_with_permissions(FactoryBot.create(:project), permissions: [:create_repository_deployment_credentials]) |
| 10 | + # @gitolite_public_key = create_ssh_key(user_id: @user_without_perm.id, key_type: 1, title: 'foo1', key: TEST_KEY) |
| 11 | + # end |
| 12 | + |
| 13 | + # describe '.keylabel' do |
| 14 | + # context 'when current user is the key owner' do |
| 15 | + # before { User.current = @user_without_perm } |
| 16 | + |
| 17 | + # it { expect(helper.keylabel(@gitolite_public_key)).to eq 'foo1' } |
| 18 | + # end |
| 19 | + |
| 20 | + # context 'when current user is not the key owner' do |
| 21 | + # before { User.current = @admin_user } |
| 22 | + |
| 23 | + # it { expect(helper.keylabel(@gitolite_public_key)).to eq 'git_anonymous@foo1' } |
| 24 | + # end |
| 25 | + # end |
| 26 | + |
| 27 | + # describe '.can_create_deployment_keys_for_some_project' do |
| 28 | + # context 'when current user is admin' do |
| 29 | + # it { expect(helper.can_create_deployment_keys_for_some_project(@admin_user)).to eq true } |
| 30 | + # end |
| 31 | + |
| 32 | + # context 'when current user can create_deployment_keys' do |
| 33 | + # it { expect(helper.can_create_deployment_keys_for_some_project(@user_with_perm)).to eq true } |
| 34 | + # end |
| 35 | + |
| 36 | + # context 'when current user cannot create_deployment_keys' do |
| 37 | + # it { expect(helper.can_create_deployment_keys_for_some_project(@user_without_perm)).to eq false } |
| 38 | + # end |
| 39 | + # end |
40 | 40 | end
|
0 commit comments