gooddata 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -1
  3. data/README.md +10 -2
  4. data/TODO.md +32 -0
  5. data/gooddata.gemspec +5 -0
  6. data/lib/gooddata.rb +4 -0
  7. data/lib/gooddata/app/app.rb +12 -0
  8. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +4 -3
  9. data/lib/gooddata/bricks/middleware/restforce_middleware.rb +2 -1
  10. data/lib/gooddata/cli/commands/console_cmd.rb +23 -5
  11. data/lib/gooddata/cli/commands/domain_cmd.rb +9 -10
  12. data/lib/gooddata/cli/commands/process_cmd.rb +11 -9
  13. data/lib/gooddata/cli/commands/project_cmd.rb +25 -27
  14. data/lib/gooddata/cli/commands/projects_cmd.rb +2 -2
  15. data/lib/gooddata/cli/commands/run_ruby_cmd.rb +1 -1
  16. data/lib/gooddata/cli/commands/user_cmd.rb +2 -2
  17. data/lib/gooddata/cli/hooks.rb +4 -2
  18. data/lib/gooddata/cli/shared.rb +1 -1
  19. data/lib/gooddata/cli/terminal.rb +1 -1
  20. data/lib/gooddata/commands/api.rb +1 -1
  21. data/lib/gooddata/commands/auth.rb +4 -28
  22. data/lib/gooddata/commands/domain.rb +9 -4
  23. data/lib/gooddata/commands/process.rb +26 -23
  24. data/lib/gooddata/commands/project.rb +74 -50
  25. data/lib/gooddata/commands/projects.rb +3 -2
  26. data/lib/gooddata/commands/role.rb +9 -3
  27. data/lib/gooddata/commands/user.rb +6 -4
  28. data/lib/gooddata/connection.rb +11 -45
  29. data/lib/gooddata/core/logging.rb +0 -1
  30. data/lib/gooddata/core/project.rb +22 -22
  31. data/lib/gooddata/core/rest.rb +9 -8
  32. data/lib/gooddata/core/user.rb +0 -11
  33. data/lib/gooddata/exceptions/project_not_found.rb +1 -0
  34. data/lib/gooddata/extensions/enumerable.rb +10 -0
  35. data/lib/gooddata/extensions/hash.rb +25 -0
  36. data/lib/gooddata/goodzilla/goodzilla.rb +4 -4
  37. data/lib/gooddata/helper/class_helper.rb +1 -0
  38. data/lib/gooddata/helper/helpers.rb +8 -0
  39. data/lib/gooddata/helpers/auth_helpers.rb +41 -0
  40. data/lib/gooddata/mixins/author.rb +1 -1
  41. data/lib/gooddata/mixins/contributor.rb +1 -1
  42. data/lib/gooddata/mixins/data_property_reader.rb +2 -0
  43. data/lib/gooddata/mixins/data_property_writer.rb +2 -0
  44. data/lib/gooddata/mixins/inspector.rb +49 -0
  45. data/lib/gooddata/mixins/md_finders.rb +16 -8
  46. data/lib/gooddata/mixins/md_id_to_uri.rb +12 -4
  47. data/lib/gooddata/mixins/md_object_indexer.rb +15 -4
  48. data/lib/gooddata/mixins/md_object_query.rb +42 -20
  49. data/lib/gooddata/mixins/md_relations.rb +21 -12
  50. data/lib/gooddata/mixins/meta_getter.rb +2 -0
  51. data/lib/gooddata/mixins/meta_property_reader.rb +2 -0
  52. data/lib/gooddata/mixins/meta_property_writer.rb +2 -0
  53. data/lib/gooddata/mixins/rest_resource.rb +32 -10
  54. data/lib/gooddata/mixins/root_key_getter.rb +1 -1
  55. data/lib/gooddata/models/data_result.rb +3 -1
  56. data/lib/gooddata/models/domain.rb +31 -22
  57. data/lib/gooddata/models/empty_result.rb +22 -0
  58. data/lib/gooddata/models/invitation.rb +11 -9
  59. data/lib/gooddata/models/links.rb +5 -3
  60. data/lib/gooddata/models/membership.rb +23 -28
  61. data/lib/gooddata/models/metadata.rb +35 -35
  62. data/lib/gooddata/models/metadata/attribute.rb +10 -8
  63. data/lib/gooddata/models/metadata/dashboard.rb +1 -1
  64. data/lib/gooddata/models/metadata/fact.rb +3 -3
  65. data/lib/gooddata/models/metadata/label.rb +4 -4
  66. data/lib/gooddata/models/metadata/metric.rb +76 -38
  67. data/lib/gooddata/models/metadata/report.rb +52 -17
  68. data/lib/gooddata/models/metadata/report_definition.rb +178 -28
  69. data/lib/gooddata/models/model.rb +13 -6
  70. data/lib/gooddata/models/process.rb +93 -30
  71. data/lib/gooddata/models/profile.rb +18 -20
  72. data/lib/gooddata/models/project.rb +344 -127
  73. data/lib/gooddata/models/project_creator.rb +32 -22
  74. data/lib/gooddata/models/project_metadata.rb +26 -14
  75. data/lib/gooddata/models/project_role.rb +15 -17
  76. data/lib/gooddata/models/report_data_result.rb +4 -0
  77. data/lib/gooddata/models/schedule.rb +51 -20
  78. data/lib/gooddata/models/schema_blueprint.rb +9 -3
  79. data/lib/gooddata/rest/README.md +37 -0
  80. data/lib/gooddata/rest/client.rb +318 -0
  81. data/lib/gooddata/rest/connection.rb +235 -0
  82. data/lib/gooddata/rest/connections/connections.rb +8 -0
  83. data/lib/gooddata/rest/connections/dummy_connection.rb +52 -0
  84. data/lib/gooddata/rest/connections/rest_client_connection.rb +177 -0
  85. data/lib/gooddata/rest/object.rb +32 -0
  86. data/lib/gooddata/rest/object_factory.rb +67 -0
  87. data/lib/gooddata/rest/resource.rb +17 -0
  88. data/lib/gooddata/rest/rest.rb +20 -0
  89. data/lib/gooddata/version.rb +1 -1
  90. data/spec/data/cc/data/source/commits.csv +4 -0
  91. data/spec/data/cc/data/source/devs.csv +4 -0
  92. data/spec/data/cc/data/source/repos.csv +3 -0
  93. data/spec/data/cc/devel.prm +0 -0
  94. data/spec/data/cc/graph/graph.grf +11 -0
  95. data/spec/data/cc/workspace.prm +19 -0
  96. data/spec/data/hello_world_process/hello_world.rb +1 -0
  97. data/spec/data/hello_world_process/hello_world.zip +0 -0
  98. data/spec/data/users.csv +12 -12
  99. data/spec/helpers/connection_helper.rb +6 -0
  100. data/spec/helpers/process_helper.rb +12 -0
  101. data/spec/helpers/project_helper.rb +2 -2
  102. data/spec/integration/command_projects_spec.rb +11 -9
  103. data/spec/integration/create_from_template_spec.rb +6 -2
  104. data/spec/integration/full_process_schedule_spec.rb +49 -36
  105. data/spec/integration/full_project_spec.rb +221 -256
  106. data/spec/integration/partial_md_export_import_spec.rb +18 -17
  107. data/spec/logging_in_logging_out_spec.rb +17 -8
  108. data/spec/spec_helper.rb +4 -2
  109. data/spec/unit/cli/commands/cmd_api_spec.rb +1 -1
  110. data/spec/unit/cli/commands/cmd_auth_spec.rb +1 -1
  111. data/spec/unit/cli/commands/cmd_domain_spec.rb +29 -3
  112. data/spec/unit/cli/commands/cmd_process_spec.rb +1 -1
  113. data/spec/unit/cli/commands/cmd_project_spec.rb +1 -1
  114. data/spec/unit/cli/commands/cmd_role_spec.rb +13 -2
  115. data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +1 -1
  116. data/spec/unit/cli/commands/cmd_scaffold_spec.rb +1 -1
  117. data/spec/unit/cli/commands/cmd_user_spec.rb +1 -1
  118. data/spec/unit/commands/command_api_spec.rb +0 -19
  119. data/spec/unit/commands/command_auth_spec.rb +20 -13
  120. data/spec/unit/commands/command_dataset_spec.rb +2 -2
  121. data/spec/unit/commands/command_process_spec.rb +24 -21
  122. data/spec/unit/commands/command_projects_spec.rb +2 -2
  123. data/spec/unit/commands/command_scaffold_spec.rb +2 -2
  124. data/spec/unit/commands/command_user_spec.rb +3 -3
  125. data/spec/unit/core/connection_spec.rb +9 -10
  126. data/spec/unit/core/project_spec.rb +8 -4
  127. data/spec/unit/core/rest_spec.rb +6 -6
  128. data/spec/unit/models/domain_spec.rb +14 -7
  129. data/spec/unit/models/invitation_spec.rb +2 -2
  130. data/spec/unit/models/membership_spec.rb +5 -5
  131. data/spec/unit/models/metric_spec.rb +92 -0
  132. data/spec/unit/models/profile_spec.rb +25 -21
  133. data/spec/unit/models/project_blueprint_spec.rb +6 -6
  134. data/spec/unit/models/project_role_spec.rb +3 -5
  135. data/spec/unit/models/project_spec.rb +43 -37
  136. data/spec/unit/models/schedule_spec.rb +58 -107
  137. data/spec/unit/rest/resource_spec.rb +6 -0
  138. metadata +87 -10
  139. data/lib/gooddata/cli/commands/role_cmd.rb +0 -28
  140. data/lib/gooddata/core/connection.rb +0 -392
  141. data/lib/gooddata/core/threaded.rb +0 -14
  142. data/lib/gooddata/models/md_object.rb +0 -25
  143. data/lib/gooddata/models/metadata/folder.rb +0 -24
  144. data/spec/unit/models/md_object_spec.rb +0 -55
  145. data/spec/unit/models/metric.rb +0 -92
@@ -7,11 +7,11 @@ require 'gooddata/models/project'
7
7
 
8
8
  describe GoodData::Profile do
9
9
  before(:all) do
10
- ConnectionHelper.create_default_connection
11
- @user = GoodData::Domain.find_user_by_login(ConnectionHelper::DEFAULT_DOMAIN, ConnectionHelper::DEFAULT_USERNAME)
10
+ @client = ConnectionHelper.create_default_connection
11
+ @user = GoodData::Domain.find_user_by_login(ConnectionHelper::DEFAULT_DOMAIN, ConnectionHelper::DEFAULT_USERNAME, :client => @client)
12
12
 
13
13
  @users = [
14
- GoodData::Profile.new(
14
+ @client.create(GoodData::Profile,
15
15
  {
16
16
  'accountSetting' => {
17
17
  'email' => 'petr.cvengros@gooddata.com',
@@ -21,7 +21,7 @@ describe GoodData::Profile do
21
21
  }
22
22
  ),
23
23
 
24
- GoodData::Profile.new(
24
+ @client.create(GoodData::Profile,
25
25
  {
26
26
  'accountSetting' => {
27
27
  'email' => 'tomas.korcak@gooddata.com',
@@ -31,7 +31,7 @@ describe GoodData::Profile do
31
31
  }
32
32
  ),
33
33
 
34
- GoodData::Profile.new(
34
+ @client.create(GoodData::Profile,
35
35
  {
36
36
  'accountSetting' => {
37
37
  'email' => 'patrick.mcconlogue@gooddata.com',
@@ -42,7 +42,7 @@ describe GoodData::Profile do
42
42
  }
43
43
  ),
44
44
 
45
- GoodData::Profile.new(
45
+ @client.create(GoodData::Profile,
46
46
  {
47
47
  'accountSetting' => {
48
48
  'email' => 'tomas.svarovsky@gooddata.com',
@@ -55,20 +55,24 @@ describe GoodData::Profile do
55
55
  end
56
56
 
57
57
  after(:all) do
58
- GoodData.disconnect
58
+ @client.disconnect
59
+ end
60
+
61
+ def deep_dup(obj)
62
+ Marshal.load(Marshal.dump(obj))
59
63
  end
60
64
 
61
65
  describe '#==' do
62
66
  it 'Returns true for same objects' do
63
- user1 = GoodData.user.dup
64
- user2 = GoodData.user.dup
67
+ user1 = deep_dup(@user)
68
+ user2 = deep_dup(@user)
65
69
  res = user1 == user2
66
70
  res.should be_true
67
71
  end
68
72
 
69
73
  it 'Returns false for different objects' do
70
- user1 = GoodData.user.dup
71
- user2 = GoodData.user.dup
74
+ user1 = deep_dup(@user)
75
+ user2 = deep_dup(@user)
72
76
 
73
77
  # Do some little modification
74
78
  user2.first_name = 'kokos'
@@ -80,15 +84,15 @@ describe GoodData::Profile do
80
84
 
81
85
  describe '#!=' do
82
86
  it 'Returns false for same objects' do
83
- user1 = GoodData.user.dup
84
- user2 = GoodData.user.dup
87
+ user1 = deep_dup(@user)
88
+ user2 = deep_dup(@user)
85
89
  res = user1 != user2
86
90
  res.should be_false
87
91
  end
88
92
 
89
93
  it 'Returns true for different objects' do
90
- user1 = GoodData.user.dup
91
- user2 = GoodData.user.dup
94
+ user1 = deep_dup(@user)
95
+ user2 = deep_dup(@user)
92
96
 
93
97
  # Do some little modification
94
98
  user2.first_name = 'kokos'
@@ -100,8 +104,8 @@ describe GoodData::Profile do
100
104
 
101
105
  describe '#apply' do
102
106
  it 'When diff of two objects applied to first result should be same as second object' do
103
- user1 = GoodData.user.dup
104
- user2 = GoodData.user.dup
107
+ user1 = deep_dup(@user)
108
+ user2 = deep_dup(@user)
105
109
 
106
110
  # Do some little modification
107
111
  user2.first_name = 'kokos'
@@ -120,16 +124,16 @@ describe GoodData::Profile do
120
124
 
121
125
  describe '#diff' do
122
126
  it 'Returns empty hash for same objects' do
123
- user1 = GoodData.user.dup
124
- user2 = GoodData.user.dup
127
+ user1 = deep_dup(@user)
128
+ user2 = deep_dup(@user)
125
129
  res = user1.diff(user2)
126
130
  expect(res).to be_instance_of(Hash)
127
131
  res.length.should eql(0)
128
132
  end
129
133
 
130
134
  it 'Returns non empty hash for different objects' do
131
- user1 = GoodData.user.dup
132
- user2 = GoodData.user.dup
135
+ user1 = deep_dup(@user)
136
+ user2 = deep_dup(@user)
133
137
 
134
138
  # Do some little modification
135
139
  user2.first_name = 'kokos'
@@ -102,33 +102,33 @@ describe GoodData::Model::ProjectBlueprint do
102
102
  end
103
103
 
104
104
  it 'should be able to grab attribute' do
105
- pending('UAAA')
105
+ pending('Wrap into object')
106
106
  @repos.labels.size.should == 1
107
107
  @repos.labels.first.attribute.name.should == 'repo_id'
108
108
  end
109
109
 
110
110
  it 'anchor should have labels' do
111
- pending('UAAA')
111
+ pending('Wrap into object')
112
112
  @repos.anchor.labels.first.identifier.should == 'label.repos.repo_id'
113
113
  end
114
114
 
115
115
  it 'attribute should have labels' do
116
- pending('UAAA')
116
+ pending('Wrap into object')
117
117
  @repos.attributes.first.labels.first.identifier.should == 'label.repos.department'
118
118
  end
119
119
 
120
120
  it 'commits should have one fact' do
121
- pending('UAAA')
121
+ pending('Wrap into object')
122
122
  @commits.facts.size.should == 1
123
123
  end
124
124
 
125
125
  it 'Anchor on repos should have a label' do
126
- pending('UAAA')
126
+ pending('Wrap into object')
127
127
  @repos.anchor.labels.size.should == 2
128
128
  end
129
129
 
130
130
  it 'should not have a label for a dataset without anchor with label' do
131
- pending('UAAA')
131
+ pending('Wrap into object')
132
132
  @commits.anchor.should == nil
133
133
  # @commits.to_schema.anchor.labels.empty?.should == true
134
134
  end
@@ -5,14 +5,14 @@ require 'gooddata/models/project_role'
5
5
 
6
6
  describe GoodData::ProjectRole do
7
7
  before(:all) do
8
- ConnectionHelper.create_default_connection
9
- @project = ProjectHelper.get_default_project
8
+ @client = ConnectionHelper.create_default_connection
9
+ @project = ProjectHelper.get_default_project(:client => @client)
10
10
  @roles = @project.roles
11
11
  @role = @roles.first
12
12
  end
13
13
 
14
14
  after(:all) do
15
- GoodData.disconnect
15
+ @client.disconnect
16
16
  end
17
17
 
18
18
  describe '#author' do
@@ -80,8 +80,6 @@ describe GoodData::ProjectRole do
80
80
 
81
81
  describe '#users' do
82
82
  it 'Returns users as Array<GoodData::Profile>' do
83
- pending 'Disable as it is TOOOO SLOOOW'
84
-
85
83
  res = @role.users
86
84
  expect(res).to be_an_instance_of(Array)
87
85
  res.each do |user|
@@ -1,14 +1,16 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require 'pmap'
4
+
3
5
  require 'gooddata'
4
6
 
5
7
  describe GoodData::Project do
6
8
  before(:each) do
7
- ConnectionHelper::create_default_connection
9
+ @client = ConnectionHelper::create_default_connection
8
10
  end
9
11
 
10
12
  after(:each) do
11
- GoodData.disconnect
13
+ @client.disconnect
12
14
  end
13
15
 
14
16
  def load_users_from_csv
@@ -40,19 +42,22 @@ describe GoodData::Project do
40
42
 
41
43
  describe '#[]' do
42
44
  it 'Accepts :all parameter' do
43
- projects = GoodData::Project[:all]
45
+ projects = GoodData::Project[:all, :client => @client]
44
46
  projects.should_not be_nil
45
47
  projects.should be_a_kind_of(Array)
48
+ projects.pmap do |project|
49
+ expect(project).to be_an_instance_of(GoodData::Project)
50
+ end
46
51
  end
47
52
 
48
53
  it 'Returns project if ID passed' do
49
- project = ProjectHelper.get_default_project
54
+ project = GoodData::Project[ProjectHelper::PROJECT_ID, :client => @client]
50
55
  project.should_not be_nil
51
56
  project.should be_a_kind_of(GoodData::Project)
52
57
  end
53
58
 
54
59
  it 'Returns project if URL passed' do
55
- project = ProjectHelper.get_default_project
60
+ project = GoodData::Project[ProjectHelper::PROJECT_URL, :client => @client]
56
61
  project.should_not be_nil
57
62
  project.should be_a_kind_of(GoodData::Project)
58
63
  end
@@ -65,7 +70,7 @@ describe GoodData::Project do
65
70
 
66
71
  describe '#all' do
67
72
  it 'Returns all projects' do
68
- projects = GoodData::Project.all
73
+ projects = GoodData::Project.all(:client => @client)
69
74
  projects.should_not be_nil
70
75
  projects.should be_a_kind_of(Array)
71
76
  end
@@ -73,7 +78,7 @@ describe GoodData::Project do
73
78
 
74
79
  describe '#get_role_by_identifier' do
75
80
  it 'Looks up for role by identifier' do
76
- project = ProjectHelper.get_default_project
81
+ project = ProjectHelper.get_default_project(:client => @client)
77
82
  role = project.get_role_by_identifier('readOnlyUserRole')
78
83
  role.should_not be_nil
79
84
  role.should be_a_kind_of(GoodData::ProjectRole)
@@ -82,7 +87,7 @@ describe GoodData::Project do
82
87
 
83
88
  describe '#get_role_by_summary' do
84
89
  it 'Looks up for role by summary' do
85
- project = ProjectHelper.get_default_project
90
+ project = ProjectHelper.get_default_project(:client => @client)
86
91
  role = project.get_role_by_summary('read only user role')
87
92
  role.should_not be_nil
88
93
  role.should be_a_kind_of(GoodData::ProjectRole)
@@ -91,7 +96,7 @@ describe GoodData::Project do
91
96
 
92
97
  describe '#get_role_by_title' do
93
98
  it 'Looks up for role by title' do
94
- project = ProjectHelper.get_default_project
99
+ project = ProjectHelper.get_default_project(:client => @client)
95
100
  role = project.get_role_by_title('Viewer')
96
101
  role.should_not be_nil
97
102
  role.should be_a_kind_of(GoodData::ProjectRole)
@@ -100,26 +105,26 @@ describe GoodData::Project do
100
105
 
101
106
  describe "#member" do
102
107
  it 'Returns GoodData::Membership when looking for existing user using email' do
103
- project = ProjectHelper.get_default_project
108
+ project = ProjectHelper.get_default_project(:client => @client)
104
109
  res = project.member('svarovsky+gem_tester@gooddata.com')
105
110
  expect(res).to be_instance_of(GoodData::Membership)
106
111
  end
107
112
 
108
113
  it 'Returns GoodData::Membership when looking for existing user using URL' do
109
- project = ProjectHelper.get_default_project
114
+ project = ProjectHelper.get_default_project(:client => @client)
110
115
  res = project.member(ConnectionHelper::DEFAULT_USER_URL)
111
116
  expect(res).to be_instance_of(GoodData::Membership)
112
117
  end
113
118
 
114
119
  it 'Returns GoodData::Membership when looking for existing user using GoodData::Profile' do
115
- project = ProjectHelper.get_default_project
120
+ project = ProjectHelper.get_default_project(:client => @client)
116
121
  user = project.members.first
117
122
  res = project.member(user)
118
123
  expect(res).to be_instance_of(GoodData::Membership)
119
124
  end
120
125
 
121
126
  it 'Returns null for non-existing user' do
122
- project = ProjectHelper.get_default_project
127
+ project = ProjectHelper.get_default_project(:client => @client)
123
128
  res = project.member('jan.kokotko@gooddata.com')
124
129
  res.should be_nil
125
130
  end
@@ -127,39 +132,39 @@ describe GoodData::Project do
127
132
 
128
133
  describe "#member?" do
129
134
  it 'Returns true when looking for existing user using email' do
130
- project = ProjectHelper.get_default_project
135
+ project = ProjectHelper.get_default_project(:client => @client)
131
136
  res = project.member?('svarovsky+gem_tester@gooddata.com')
132
137
  res.should be_true
133
138
  end
134
139
 
135
140
  it 'Returns true when looking for existing user using URL' do
136
- project = ProjectHelper.get_default_project
141
+ project = ProjectHelper.get_default_project(:client => @client)
137
142
  res = project.member?(ConnectionHelper::DEFAULT_USER_URL)
138
143
  res.should be_true
139
144
  end
140
145
 
141
146
  it 'Returns true when looking for existing user using GoodData::Profile' do
142
- project = ProjectHelper.get_default_project
147
+ project = ProjectHelper.get_default_project(:client => @client)
143
148
  user = project.members.first
144
149
  res = project.member?(user)
145
150
  res.should be_true
146
151
  end
147
152
 
148
153
  it 'Returns false for non-existing user' do
149
- project = ProjectHelper.get_default_project
154
+ project = ProjectHelper.get_default_project(:client => @client)
150
155
  res = project.member?('jan.kokotko@gooddata.com')
151
156
  res.should be_false
152
157
  end
153
158
 
154
159
  it 'Returns true for existing user when using optional list' do
155
- project = ProjectHelper.get_default_project
160
+ project = ProjectHelper.get_default_project(:client => @client)
156
161
  list = project.members
157
162
  res = project.member?('svarovsky+gem_tester@gooddata.com', list)
158
163
  res.should be_true
159
164
  end
160
165
 
161
166
  it 'Returns false for non-existing user when using optional list' do
162
- project = ProjectHelper.get_default_project
167
+ project = ProjectHelper.get_default_project(:client => @client)
163
168
  list = []
164
169
  res = project.member?('svarovsky+gem_tester@gooddata.com', list)
165
170
  res.should be_false
@@ -169,16 +174,16 @@ describe GoodData::Project do
169
174
  describe '#processes' do
170
175
  it 'Returns the processes' do
171
176
 
172
- GoodData.project = ProjectHelper::PROJECT_ID
173
- proj = GoodData.project
174
- processes = proj.processes
177
+ project = GoodData::Project[ProjectHelper::PROJECT_ID, {:client => @client}]
178
+ processes = project.processes
175
179
  expect(processes).to be_a_kind_of(Array)
176
180
  end
177
181
  end
178
182
 
179
183
  describe '#roles' do
180
184
  it 'Returns array of GoodData::ProjectRole' do
181
- project = ProjectHelper.get_default_project
185
+ pending 'Investigate why is this soo slooow'
186
+ project = ProjectHelper.get_default_project(:client => @client)
182
187
  roles = project.roles
183
188
  expect(roles).to be_instance_of(Array)
184
189
 
@@ -190,9 +195,9 @@ describe GoodData::Project do
190
195
 
191
196
  describe '#users' do
192
197
  it 'Returns array of GoodData::Users' do
193
- pending 'Disable as it is TOOOO SLOOOW'
198
+ pending 'Investigate why is this soo slooow'
194
199
 
195
- project = GoodData::Project[ProjectHelper::PROJECT_ID]
200
+ project = GoodData::Project[ProjectHelper::PROJECT_ID, {:client => @client}]
196
201
 
197
202
  invitations = project.invitations
198
203
  invitations.should_not be_nil
@@ -220,7 +225,7 @@ describe GoodData::Project do
220
225
  # invitations = user.invitations
221
226
  # invitations.should_not be_nil
222
227
 
223
- if(user.email == 'tomas.korcak@gooddata.com')
228
+ if (user.email == 'tomas.korcak@gooddata.com')
224
229
  projects = user.projects
225
230
  projects.should_not be_nil
226
231
  expect(projects).to be_instance_of(Array)
@@ -235,7 +240,7 @@ describe GoodData::Project do
235
240
 
236
241
  describe '#users_create' do
237
242
  it 'Creates new users' do
238
- project = ProjectHelper.get_default_project
243
+ project = ProjectHelper.get_default_project(:client => @client)
239
244
 
240
245
  users = (0...10).map do |i|
241
246
  num = rand(1e6)
@@ -265,7 +270,8 @@ describe GoodData::Project do
265
270
  GoodData::Membership.new(json)
266
271
  end
267
272
 
268
- res = GoodData::Domain.users_create(users)
273
+ project = GoodData::Project[ProjectHelper::PROJECT_ID, {:client => @client}]
274
+ res = GoodData::Domain.users_create(users, nil, {:client => @client, :project => project})
269
275
 
270
276
  project.users_create(users)
271
277
 
@@ -280,7 +286,7 @@ describe GoodData::Project do
280
286
  describe '#users_import' do
281
287
  it 'Import users from CSV' do
282
288
 
283
- project = GoodData::Project[ProjectHelper::PROJECT_ID]
289
+ project = GoodData::Project[ProjectHelper::PROJECT_ID, {:client => @client}]
284
290
 
285
291
  new_users = load_users_from_csv
286
292
 
@@ -290,7 +296,7 @@ describe GoodData::Project do
290
296
 
291
297
  describe '#set_user_roles' do
292
298
  it 'Properly updates user roles as needed' do
293
- project = ProjectHelper.get_default_project
299
+ project = ProjectHelper.get_default_project(:client => @client)
294
300
 
295
301
  project.set_user_roles(ConnectionHelper::DEFAULT_USERNAME, 'admin')
296
302
  end
@@ -298,12 +304,12 @@ describe GoodData::Project do
298
304
 
299
305
  describe '#set_users_roles' do
300
306
  it 'Properly updates user roles as needed for bunch of users' do
301
- project = ProjectHelper.get_default_project
307
+ project = ProjectHelper.get_default_project(:client => @client)
302
308
 
303
309
  list = load_users_from_csv
304
310
 
305
311
  # Create domain users
306
- domain_users = GoodData::Domain.users_create(list, ConnectionHelper::DEFAULT_DOMAIN)
312
+ domain_users = GoodData::Domain.users_create(list, ConnectionHelper::DEFAULT_DOMAIN, :client => @client, :project => project)
307
313
  expect(domain_users.length).to equal(list.length)
308
314
 
309
315
  # Create list with user, desired_roles hashes
@@ -326,12 +332,12 @@ describe GoodData::Project do
326
332
  end
327
333
 
328
334
  domain_users.each do |user|
329
- user.delete if user.email != ConnectionHelper::DEFAULT_USERNAME
335
+ user.delete if user.email != ConnectionHelper::DEFAULT_USERNAME
330
336
  end
331
337
  end
332
338
 
333
339
  it 'Properly updates user roles when user specified by email and :roles specified as array of string with role names' do
334
- project = ProjectHelper.get_default_project
340
+ project = ProjectHelper.get_default_project(:client => @client)
335
341
 
336
342
  list = [
337
343
  {
@@ -345,7 +351,7 @@ describe GoodData::Project do
345
351
  end
346
352
 
347
353
  it 'Properly updates user roles when user specified by email and :roles specified as string with role name' do
348
- project = ProjectHelper.get_default_project
354
+ project = ProjectHelper.get_default_project(:client => @client)
349
355
 
350
356
  list = [
351
357
  {
@@ -361,7 +367,7 @@ describe GoodData::Project do
361
367
 
362
368
  describe '#summary' do
363
369
  it 'Properly gets title of project' do
364
- project = ProjectHelper.get_default_project
370
+ project = ProjectHelper.get_default_project(:client => @client)
365
371
 
366
372
  res = project.summary
367
373
  expect(res).to include(ProjectHelper::PROJECT_SUMMARY)
@@ -370,7 +376,7 @@ describe GoodData::Project do
370
376
 
371
377
  describe '#title' do
372
378
  it 'Properly gets title of project' do
373
- project = ProjectHelper.get_default_project
379
+ project = ProjectHelper.get_default_project(:client => @client)
374
380
 
375
381
  res = project.title
376
382
  expect(res).to include(ProjectHelper::PROJECT_TITLE)