gooddata 0.6.15 → 0.6.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,122 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'gooddata'
4
+
5
+ describe GoodData::Project do
6
+ before(:all) do
7
+ GoodData.logging_on
8
+ @client = ConnectionHelper::create_default_connection
9
+ @p = GoodData::Project.create_object(title: 'a', client: @client)
10
+ @domain = @client.domain('dummy_domain')
11
+ @roles = [
12
+ GoodData::ProjectRole.create_object(title: 'Test Role',
13
+ summary: 'Test role summary',
14
+ identifier: 'test_role',
15
+ uri: '/roles/1',
16
+ permissions: {
17
+ "canManageFact" => "1",
18
+ "canListInvitationsInProject" => "1"
19
+ }),
20
+ GoodData::ProjectRole.create_object(title: 'Test Role 2',
21
+ summary: 'Test role 2 summary',
22
+ identifier: 'test_role_2',
23
+ uri: '/roles/2',
24
+ permissions: {
25
+ "canManageFact" => "1"
26
+ })
27
+ ]
28
+ @domain_members = [
29
+ GoodData::Profile.create_object(login: 'john.doe+in_domain@gooddata.com', uri: '/uri/john_domain'),
30
+ ]
31
+ @members = [
32
+ GoodData::Membership.create(login: 'john.doe@goodadta.com', uri: '/uri/john'),
33
+ GoodData::Membership.create(login: 'jane.doe@goodadta.com', uri: '/uri/jane')
34
+ ]
35
+ end
36
+
37
+ describe 'verify_user_to_add' do
38
+ it 'Can handle case with user login when user is in the project' do
39
+ # we have to provide users from project to be able to do this by login
40
+ a, b = @p.verify_user_to_add('john.doe@goodadta.com', 'test_role', project_users: @members, roles: @roles)
41
+ expect(a).to eq "/uri/john"
42
+ expect(b).to eq ["/roles/1"]
43
+ end
44
+
45
+ it 'Can handle case with user uri when user is in the project' do
46
+ # we have to provide users from project to be able to do this by login
47
+ a, b = @p.verify_user_to_add('/uri/john', 'test_role', project_users: @members, roles: @roles)
48
+ expect(a).to eq "/uri/john"
49
+ expect(b).to eq ["/roles/1"]
50
+ end
51
+
52
+ it 'can handle case with info with uri when user is in the project' do
53
+ # we have to provide users from project to be able to do this by login
54
+ a, b = @p.verify_user_to_add({uri: '/uri/john', first_name: 'John'}, 'test_role', project_users: @members, roles: @roles)
55
+ expect(a).to eq "/uri/john"
56
+ expect(b).to eq ["/roles/1"]
57
+ end
58
+
59
+ it 'can handle case with info with login when he is in the project' do
60
+ # we have to provide users from project to be able to do this by login
61
+ a, b = @p.verify_user_to_add({ login: 'john.doe@goodadta.com', first_name: 'John' }, 'test_role', project_users: @members, roles: @roles)
62
+ expect(a).to eq "/uri/john"
63
+ expect(b).to eq ["/roles/1"]
64
+ end
65
+
66
+ it 'can handle case with member when he is in the project' do
67
+ # we have to provide users from project to be able to do this by login
68
+ a, b = @p.verify_user_to_add(@members.first, 'test_role_2', project_users: @members, roles: @roles)
69
+ expect(a).to eq "/uri/john"
70
+ expect(b).to eq ["/roles/2"]
71
+ end
72
+
73
+ it 'can handle case with profile when the user is in the project' do
74
+ # we have to provide users from project to be able to do this by login
75
+ a, b = @p.verify_user_to_add(@domain_members.first, 'test_role_2', project_users: @members, roles: @roles)
76
+ expect(a).to eq "/uri/john_domain"
77
+ expect(b).to eq ["/roles/2"]
78
+ end
79
+
80
+ it 'Can handle case with user login when user is in the domain' do
81
+ # we have to provide users from project to be able to do this by login
82
+ a, b = @p.verify_user_to_add('john.doe+in_domain@gooddata.com', 'test_role', project_users: [], domain_users: @domain_members, roles: @roles, domain: @domain)
83
+ expect(a).to eq "/uri/john_domain"
84
+ expect(b).to eq ["/roles/1"]
85
+ end
86
+
87
+ it 'Can handle case with user uri when user is in the domain' do
88
+ # we have to provide users from project to be able to do this by login
89
+ a, b = @p.verify_user_to_add('/uri/john_domain', 'test_role', project_users: [], domain_users: @domain_members, roles: @roles, domain: @domain)
90
+ expect(a).to eq "/uri/john_domain"
91
+ expect(b).to eq ["/roles/1"]
92
+ end
93
+
94
+ it 'can handle case with info with uri when user is in the domain' do
95
+ # we have to provide users from project to be able to do this by login
96
+ a, b = @p.verify_user_to_add({uri: '/uri/john_domain', first_name: 'John'}, 'test_role', project_users: [], domain_users: @domain_members, roles: @roles, domain: @domain)
97
+ expect(a).to eq "/uri/john_domain"
98
+ expect(b).to eq ["/roles/1"]
99
+ end
100
+
101
+ it 'can handle case with info with login when he is in the domain' do
102
+ # we have to provide users from project to be able to do this by login
103
+ a, b = @p.verify_user_to_add({ login: 'john.doe+in_domain@gooddata.com', first_name: 'John' }, 'test_role', project_users: [], domain_users: @domain_members, roles: @roles, domain: @domain)
104
+ expect(a).to eq "/uri/john_domain"
105
+ expect(b).to eq ["/roles/1"]
106
+ end
107
+
108
+ it 'can handle case with member when he is in the domain' do
109
+ # we have to provide users from project to be able to do this by login
110
+ a, b = @p.verify_user_to_add(@domain_members.first, 'test_role_2', project_users: [], domain_users: @domain_members, roles: @roles, domain: @domain)
111
+ expect(a).to eq "/uri/john_domain"
112
+ expect(b).to eq ["/roles/2"]
113
+ end
114
+
115
+ it 'can handle case with profile when the user is in the domain' do
116
+ # we have to provide users from project to be able to do this by login
117
+ a, b = @p.verify_user_to_add(@domain_members.first, 'test_role_2', project_users: [], domain_users: @domain_members, roles: @roles)
118
+ expect(a).to eq "/uri/john_domain"
119
+ expect(b).to eq ["/roles/2"]
120
+ end
121
+ end
122
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gooddata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.15
4
+ version: 0.6.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kolesnikov
@@ -609,6 +609,7 @@ files:
609
609
  - lib/gooddata/bricks/middleware/bench_middleware.rb
610
610
  - lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb
611
611
  - lib/gooddata/bricks/middleware/decode_params_middleware.rb
612
+ - lib/gooddata/bricks/middleware/fs_download_middleware.rb
612
613
  - lib/gooddata/bricks/middleware/fs_upload_middleware.rb
613
614
  - lib/gooddata/bricks/middleware/gooddata_middleware.rb
614
615
  - lib/gooddata/bricks/middleware/logger_middleware.rb
@@ -672,6 +673,7 @@ files:
672
673
  - lib/gooddata/goodzilla/goodzilla.rb
673
674
  - lib/gooddata/helpers/auth_helpers.rb
674
675
  - lib/gooddata/helpers/csv_helper.rb
676
+ - lib/gooddata/helpers/data_helper.rb
675
677
  - lib/gooddata/helpers/global_helpers.rb
676
678
  - lib/gooddata/helpers/helpers.rb
677
679
  - lib/gooddata/mixins/author.rb
@@ -884,6 +886,7 @@ files:
884
886
  - spec/unit/models/schema_builder_spec.rb
885
887
  - spec/unit/models/to_manifest_spec.rb
886
888
  - spec/unit/models/to_wire_spec.rb
889
+ - spec/unit/models/unit_project.rb
887
890
  - spec/unit/models/user_filters_spec.rb
888
891
  - spec/unit/models/variable_spec.rb
889
892
  - spec/unit/rest/resource_spec.rb