Commit 02798bcc8d29b20b31061831c2fe97cbd39837b3
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'stable' of gitlab.com:participa/noosfero into stable
Showing
3 changed files
with
4 additions
and
39 deletions
Show diff stats
plugins/serpro_integration/Gemfile
plugins/serpro_integration/lib/serpro_integration_plugin/gitlab_integration.rb
@@ -10,7 +10,7 @@ class SerproIntegrationPlugin::GitlabIntegration | @@ -10,7 +10,7 @@ class SerproIntegrationPlugin::GitlabIntegration | ||
10 | 10 | ||
11 | def create_group(group_name) | 11 | def create_group(group_name) |
12 | #FIXME find group by name | 12 | #FIXME find group by name |
13 | - group = @client.groups.select {|group| group.name == group_name}.first | 13 | + group = @client.groups(:search => group_name).select {|group| group.name == group_name}.first |
14 | group ||= @client.create_group(group_name, group_name) | 14 | group ||= @client.create_group(group_name, group_name) |
15 | @group = group | 15 | @group = group |
16 | end | 16 | end |
@@ -46,6 +46,7 @@ class SerproIntegrationPlugin::GitlabIntegration | @@ -46,6 +46,7 @@ class SerproIntegrationPlugin::GitlabIntegration | ||
46 | @client.add_group_member(group.id, user.id, 40) | 46 | @client.add_group_member(group.id, user.id, 40) |
47 | rescue Gitlab::Error::Conflict => e | 47 | rescue Gitlab::Error::Conflict => e |
48 | #already member | 48 | #already member |
49 | + Rails.logger.info e.to_s | ||
49 | end | 50 | end |
50 | user | 51 | user |
51 | end | 52 | end |
plugins/serpro_integration/test/unit/sonar_plugin_test.rb
1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
2 | 2 | ||
3 | -class RequireAuthToCommentPluginTest < ActiveSupport::TestCase | ||
4 | - | ||
5 | - def setup | ||
6 | - @plugin = RequireAuthToCommentPlugin.new | ||
7 | - @comment = Comment.new | ||
8 | - end | ||
9 | - | ||
10 | - attr_reader :plugin, :comment | ||
11 | - | ||
12 | - should 'reject comments for unauthenticated users' do | ||
13 | - plugin.context = logged_in(false) | ||
14 | - plugin.filter_comment(comment) | ||
15 | - assert comment.rejected? | ||
16 | - end | ||
17 | - | ||
18 | - should 'allow comments from authenticated users' do | ||
19 | - plugin.context = logged_in(true) | ||
20 | - plugin.filter_comment(comment) | ||
21 | - assert !comment.rejected? | ||
22 | - end | ||
23 | - | ||
24 | - should 'allow comments from unauthenticated users if allowed by profile' do | ||
25 | - plugin.context = logged_in(false) | ||
26 | - plugin.context.profile.allow_unauthenticated_comments = true | ||
27 | - | ||
28 | - plugin.filter_comment(comment) | ||
29 | - assert !comment.rejected? | ||
30 | - end | ||
31 | - | ||
32 | - protected | ||
33 | - | ||
34 | - def logged_in(boolean) | ||
35 | - controller = mock() | ||
36 | - controller.stubs(:logged_in?).returns(boolean) | ||
37 | - controller.stubs(:profile).returns(Profile.new) | ||
38 | - controller | ||
39 | - end | 3 | +class SonarPluginTest < ActiveSupport::TestCase |
40 | 4 | ||
41 | end | 5 | end |