gooddata 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -1
- data/README.md +10 -2
- data/TODO.md +32 -0
- data/gooddata.gemspec +5 -0
- data/lib/gooddata.rb +4 -0
- data/lib/gooddata/app/app.rb +12 -0
- data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +4 -3
- data/lib/gooddata/bricks/middleware/restforce_middleware.rb +2 -1
- data/lib/gooddata/cli/commands/console_cmd.rb +23 -5
- data/lib/gooddata/cli/commands/domain_cmd.rb +9 -10
- data/lib/gooddata/cli/commands/process_cmd.rb +11 -9
- data/lib/gooddata/cli/commands/project_cmd.rb +25 -27
- data/lib/gooddata/cli/commands/projects_cmd.rb +2 -2
- data/lib/gooddata/cli/commands/run_ruby_cmd.rb +1 -1
- data/lib/gooddata/cli/commands/user_cmd.rb +2 -2
- data/lib/gooddata/cli/hooks.rb +4 -2
- data/lib/gooddata/cli/shared.rb +1 -1
- data/lib/gooddata/cli/terminal.rb +1 -1
- data/lib/gooddata/commands/api.rb +1 -1
- data/lib/gooddata/commands/auth.rb +4 -28
- data/lib/gooddata/commands/domain.rb +9 -4
- data/lib/gooddata/commands/process.rb +26 -23
- data/lib/gooddata/commands/project.rb +74 -50
- data/lib/gooddata/commands/projects.rb +3 -2
- data/lib/gooddata/commands/role.rb +9 -3
- data/lib/gooddata/commands/user.rb +6 -4
- data/lib/gooddata/connection.rb +11 -45
- data/lib/gooddata/core/logging.rb +0 -1
- data/lib/gooddata/core/project.rb +22 -22
- data/lib/gooddata/core/rest.rb +9 -8
- data/lib/gooddata/core/user.rb +0 -11
- data/lib/gooddata/exceptions/project_not_found.rb +1 -0
- data/lib/gooddata/extensions/enumerable.rb +10 -0
- data/lib/gooddata/extensions/hash.rb +25 -0
- data/lib/gooddata/goodzilla/goodzilla.rb +4 -4
- data/lib/gooddata/helper/class_helper.rb +1 -0
- data/lib/gooddata/helper/helpers.rb +8 -0
- data/lib/gooddata/helpers/auth_helpers.rb +41 -0
- data/lib/gooddata/mixins/author.rb +1 -1
- data/lib/gooddata/mixins/contributor.rb +1 -1
- data/lib/gooddata/mixins/data_property_reader.rb +2 -0
- data/lib/gooddata/mixins/data_property_writer.rb +2 -0
- data/lib/gooddata/mixins/inspector.rb +49 -0
- data/lib/gooddata/mixins/md_finders.rb +16 -8
- data/lib/gooddata/mixins/md_id_to_uri.rb +12 -4
- data/lib/gooddata/mixins/md_object_indexer.rb +15 -4
- data/lib/gooddata/mixins/md_object_query.rb +42 -20
- data/lib/gooddata/mixins/md_relations.rb +21 -12
- data/lib/gooddata/mixins/meta_getter.rb +2 -0
- data/lib/gooddata/mixins/meta_property_reader.rb +2 -0
- data/lib/gooddata/mixins/meta_property_writer.rb +2 -0
- data/lib/gooddata/mixins/rest_resource.rb +32 -10
- data/lib/gooddata/mixins/root_key_getter.rb +1 -1
- data/lib/gooddata/models/data_result.rb +3 -1
- data/lib/gooddata/models/domain.rb +31 -22
- data/lib/gooddata/models/empty_result.rb +22 -0
- data/lib/gooddata/models/invitation.rb +11 -9
- data/lib/gooddata/models/links.rb +5 -3
- data/lib/gooddata/models/membership.rb +23 -28
- data/lib/gooddata/models/metadata.rb +35 -35
- data/lib/gooddata/models/metadata/attribute.rb +10 -8
- data/lib/gooddata/models/metadata/dashboard.rb +1 -1
- data/lib/gooddata/models/metadata/fact.rb +3 -3
- data/lib/gooddata/models/metadata/label.rb +4 -4
- data/lib/gooddata/models/metadata/metric.rb +76 -38
- data/lib/gooddata/models/metadata/report.rb +52 -17
- data/lib/gooddata/models/metadata/report_definition.rb +178 -28
- data/lib/gooddata/models/model.rb +13 -6
- data/lib/gooddata/models/process.rb +93 -30
- data/lib/gooddata/models/profile.rb +18 -20
- data/lib/gooddata/models/project.rb +344 -127
- data/lib/gooddata/models/project_creator.rb +32 -22
- data/lib/gooddata/models/project_metadata.rb +26 -14
- data/lib/gooddata/models/project_role.rb +15 -17
- data/lib/gooddata/models/report_data_result.rb +4 -0
- data/lib/gooddata/models/schedule.rb +51 -20
- data/lib/gooddata/models/schema_blueprint.rb +9 -3
- data/lib/gooddata/rest/README.md +37 -0
- data/lib/gooddata/rest/client.rb +318 -0
- data/lib/gooddata/rest/connection.rb +235 -0
- data/lib/gooddata/rest/connections/connections.rb +8 -0
- data/lib/gooddata/rest/connections/dummy_connection.rb +52 -0
- data/lib/gooddata/rest/connections/rest_client_connection.rb +177 -0
- data/lib/gooddata/rest/object.rb +32 -0
- data/lib/gooddata/rest/object_factory.rb +67 -0
- data/lib/gooddata/rest/resource.rb +17 -0
- data/lib/gooddata/rest/rest.rb +20 -0
- data/lib/gooddata/version.rb +1 -1
- data/spec/data/cc/data/source/commits.csv +4 -0
- data/spec/data/cc/data/source/devs.csv +4 -0
- data/spec/data/cc/data/source/repos.csv +3 -0
- data/spec/data/cc/devel.prm +0 -0
- data/spec/data/cc/graph/graph.grf +11 -0
- data/spec/data/cc/workspace.prm +19 -0
- data/spec/data/hello_world_process/hello_world.rb +1 -0
- data/spec/data/hello_world_process/hello_world.zip +0 -0
- data/spec/data/users.csv +12 -12
- data/spec/helpers/connection_helper.rb +6 -0
- data/spec/helpers/process_helper.rb +12 -0
- data/spec/helpers/project_helper.rb +2 -2
- data/spec/integration/command_projects_spec.rb +11 -9
- data/spec/integration/create_from_template_spec.rb +6 -2
- data/spec/integration/full_process_schedule_spec.rb +49 -36
- data/spec/integration/full_project_spec.rb +221 -256
- data/spec/integration/partial_md_export_import_spec.rb +18 -17
- data/spec/logging_in_logging_out_spec.rb +17 -8
- data/spec/spec_helper.rb +4 -2
- data/spec/unit/cli/commands/cmd_api_spec.rb +1 -1
- data/spec/unit/cli/commands/cmd_auth_spec.rb +1 -1
- data/spec/unit/cli/commands/cmd_domain_spec.rb +29 -3
- data/spec/unit/cli/commands/cmd_process_spec.rb +1 -1
- data/spec/unit/cli/commands/cmd_project_spec.rb +1 -1
- data/spec/unit/cli/commands/cmd_role_spec.rb +13 -2
- data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +1 -1
- data/spec/unit/cli/commands/cmd_scaffold_spec.rb +1 -1
- data/spec/unit/cli/commands/cmd_user_spec.rb +1 -1
- data/spec/unit/commands/command_api_spec.rb +0 -19
- data/spec/unit/commands/command_auth_spec.rb +20 -13
- data/spec/unit/commands/command_dataset_spec.rb +2 -2
- data/spec/unit/commands/command_process_spec.rb +24 -21
- data/spec/unit/commands/command_projects_spec.rb +2 -2
- data/spec/unit/commands/command_scaffold_spec.rb +2 -2
- data/spec/unit/commands/command_user_spec.rb +3 -3
- data/spec/unit/core/connection_spec.rb +9 -10
- data/spec/unit/core/project_spec.rb +8 -4
- data/spec/unit/core/rest_spec.rb +6 -6
- data/spec/unit/models/domain_spec.rb +14 -7
- data/spec/unit/models/invitation_spec.rb +2 -2
- data/spec/unit/models/membership_spec.rb +5 -5
- data/spec/unit/models/metric_spec.rb +92 -0
- data/spec/unit/models/profile_spec.rb +25 -21
- data/spec/unit/models/project_blueprint_spec.rb +6 -6
- data/spec/unit/models/project_role_spec.rb +3 -5
- data/spec/unit/models/project_spec.rb +43 -37
- data/spec/unit/models/schedule_spec.rb +58 -107
- data/spec/unit/rest/resource_spec.rb +6 -0
- metadata +87 -10
- data/lib/gooddata/cli/commands/role_cmd.rb +0 -28
- data/lib/gooddata/core/connection.rb +0 -392
- data/lib/gooddata/core/threaded.rb +0 -14
- data/lib/gooddata/models/md_object.rb +0 -25
- data/lib/gooddata/models/metadata/folder.rb +0 -24
- data/spec/unit/models/md_object_spec.rb +0 -55
- data/spec/unit/models/metric.rb +0 -92
@@ -1,14 +1,16 @@
|
|
1
1
|
require 'gooddata/commands/process'
|
2
2
|
|
3
3
|
describe GoodData::Command::Process do
|
4
|
-
deploy_dir = '
|
4
|
+
deploy_dir = File.join(File.dirname(__FILE__), '..', '..', 'data/cc')
|
5
|
+
graph_path = 'graph/graph.grf'
|
5
6
|
|
6
7
|
before(:each) do
|
7
|
-
ConnectionHelper.create_default_connection
|
8
|
+
@client = ConnectionHelper.create_default_connection
|
9
|
+
@project = ProjectHelper.get_default_project(:client => @client)
|
8
10
|
end
|
9
11
|
|
10
12
|
after(:each) do
|
11
|
-
|
13
|
+
@client.disconnect
|
12
14
|
end
|
13
15
|
|
14
16
|
it "Is Possible to create GoodData::Command::Process instance" do
|
@@ -17,13 +19,20 @@ describe GoodData::Command::Process do
|
|
17
19
|
end
|
18
20
|
|
19
21
|
describe "#get" do
|
20
|
-
it "Should throw exception if no
|
22
|
+
it "Should throw exception if no Project ID specified" do
|
21
23
|
expect { GoodData::Command::Process.get }.to raise_error
|
22
24
|
end
|
23
25
|
|
24
|
-
it "
|
25
|
-
|
26
|
-
|
26
|
+
it "Should throw exception if no Process ID specified" do
|
27
|
+
expect { GoodData::Command::Process.get(:project_id => ProjectHelper::PROJECT_ID) }.to raise_error
|
28
|
+
end
|
29
|
+
|
30
|
+
it "Gets process by process ID" do
|
31
|
+
pending "SystemStackError: stack level too deep"
|
32
|
+
|
33
|
+
res = GoodData::Command::Process.get(:project_id => ProjectHelper::PROJECT_ID, :process_id => ProcessHelper::PROCESS_ID)
|
34
|
+
expect(res).to_not be_nil
|
35
|
+
expect(res).to be_an_instance_of(GoodData::Process)
|
27
36
|
end
|
28
37
|
end
|
29
38
|
|
@@ -34,8 +43,7 @@ describe GoodData::Command::Process do
|
|
34
43
|
end
|
35
44
|
|
36
45
|
it "Deploys graph" do
|
37
|
-
|
38
|
-
GoodData::Command::Process.deploy(deploy_dir)
|
46
|
+
GoodData::Command::Process.deploy(deploy_dir, :name => ProcessHelper::DEPLOY_NAME, :project_id => ProjectHelper::PROJECT_ID, :client => @client, :project => @project)
|
39
47
|
end
|
40
48
|
end
|
41
49
|
|
@@ -49,31 +57,26 @@ describe GoodData::Command::Process do
|
|
49
57
|
end
|
50
58
|
|
51
59
|
describe "#list" do
|
52
|
-
it "Should throw exception if no project specified" do
|
53
|
-
expect { GoodData::Command::Process.list }.to raise_error
|
54
|
-
end
|
55
|
-
|
56
60
|
it "Returns processes" do
|
57
|
-
|
58
|
-
|
61
|
+
res = GoodData::Command::Process.list(:project_id => ProjectHelper::PROJECT_ID, :client => @client, :project => @project)
|
62
|
+
expect(res).to be_an_instance_of(Array)
|
59
63
|
end
|
60
64
|
end
|
61
65
|
|
62
66
|
describe "#run" do
|
63
67
|
it "Throws exception if no project specified" do
|
64
|
-
expect { GoodData::Command::Process.run(deploy_dir,
|
68
|
+
expect { GoodData::Command::Process.run(deploy_dir, graph_path) }.to raise_error
|
65
69
|
end
|
66
70
|
|
67
71
|
it "Runs process" do
|
68
|
-
|
69
|
-
GoodData::Command::Process.run(deploy_dir, './main.grf')
|
72
|
+
# GoodData::Command::Process.run(deploy_dir, graph_path)
|
70
73
|
end
|
71
74
|
end
|
72
75
|
|
73
76
|
describe "#with_deploy" do
|
74
77
|
it "Should throw exception if no project specified" do
|
75
78
|
expect do
|
76
|
-
GoodData::
|
79
|
+
GoodData::Process.with_deploy(deploy_dir) do
|
77
80
|
msg = "Hello World!"
|
78
81
|
end
|
79
82
|
|
@@ -81,8 +84,8 @@ describe GoodData::Command::Process do
|
|
81
84
|
end
|
82
85
|
|
83
86
|
it "Executes block when deploying" do
|
84
|
-
pending('Project ID needed')
|
85
|
-
GoodData::
|
87
|
+
# pending('Project ID needed')
|
88
|
+
GoodData::Process.with_deploy(deploy_dir, :name => ProcessHelper::DEPLOY_NAME, :project_id => ProjectHelper::PROJECT_ID, :client => @client, :project => @project) do
|
86
89
|
msg = "Hello World!"
|
87
90
|
end
|
88
91
|
end
|
@@ -2,11 +2,11 @@ require 'gooddata/commands/project'
|
|
2
2
|
|
3
3
|
describe GoodData::Command::Project do
|
4
4
|
before(:each) do
|
5
|
-
ConnectionHelper.create_default_connection
|
5
|
+
@client = ConnectionHelper.create_default_connection
|
6
6
|
end
|
7
7
|
|
8
8
|
after(:each) do
|
9
|
-
|
9
|
+
@client.disconnect
|
10
10
|
end
|
11
11
|
|
12
12
|
it "Is Possible to create GoodData::Command::Project instance" do
|
@@ -6,11 +6,11 @@ describe GoodData::Command::Scaffold do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
before(:each) do
|
9
|
-
ConnectionHelper.create_default_connection
|
9
|
+
@client = ConnectionHelper.create_default_connection
|
10
10
|
end
|
11
11
|
|
12
12
|
after(:each) do
|
13
|
-
|
13
|
+
@client.disconnect
|
14
14
|
end
|
15
15
|
|
16
16
|
it "Is Possible to create GoodData::Command::Scaffold instance" do
|
@@ -2,11 +2,11 @@ require 'gooddata/commands/user'
|
|
2
2
|
|
3
3
|
describe GoodData::Command::User do
|
4
4
|
before(:each) do
|
5
|
-
ConnectionHelper.create_default_connection
|
5
|
+
@client = ConnectionHelper.create_default_connection
|
6
6
|
end
|
7
7
|
|
8
8
|
after(:each) do
|
9
|
-
|
9
|
+
@client.disconnect
|
10
10
|
end
|
11
11
|
|
12
12
|
it "Is Possible to create GoodData::Command::Membership instance" do
|
@@ -16,7 +16,7 @@ describe GoodData::Command::User do
|
|
16
16
|
|
17
17
|
describe "#show" do
|
18
18
|
it "Shows profile" do
|
19
|
-
GoodData::Command::User.show
|
19
|
+
GoodData::Command::User.show(:client => @client)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -1,36 +1,35 @@
|
|
1
1
|
require 'gooddata/connection'
|
2
|
-
require 'gooddata/core/connection'
|
3
2
|
|
4
|
-
describe GoodData::Connection do
|
3
|
+
describe GoodData::Rest::Connection do
|
5
4
|
before(:all) do
|
6
5
|
USERNAME = ConnectionHelper::DEFAULT_USERNAME
|
7
6
|
PASSWORD = ConnectionHelper::DEFAULT_PASSWORD
|
8
7
|
end
|
9
8
|
|
10
9
|
it "Has DEFAULT_URL defined" do
|
11
|
-
GoodData::Connection::DEFAULT_URL.should be_a(String)
|
10
|
+
GoodData::Rest::Connection::DEFAULT_URL.should be_a(String)
|
12
11
|
end
|
13
12
|
|
14
13
|
it "Has LOGIN_PATH defined" do
|
15
|
-
GoodData::Connection::LOGIN_PATH.should be_a(String)
|
14
|
+
GoodData::Rest::Connection::LOGIN_PATH.should be_a(String)
|
16
15
|
end
|
17
16
|
|
18
17
|
it "Has TOKEN_PATH defined" do
|
19
|
-
GoodData::Connection::TOKEN_PATH.should be_a(String)
|
18
|
+
GoodData::Rest::Connection::TOKEN_PATH.should be_a(String)
|
20
19
|
end
|
21
20
|
|
22
21
|
describe '#connect' do
|
23
22
|
it "Connects using username and password" do
|
24
23
|
c = GoodData.connect(ConnectionHelper::DEFAULT_USERNAME, ConnectionHelper::DEFAULT_PASSWORD)
|
25
|
-
c.should be_a(GoodData::
|
26
|
-
|
24
|
+
c.should be_a(GoodData::Rest::Client)
|
25
|
+
c.disconnect
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
30
29
|
describe '#disconnect' do
|
31
30
|
it "Connects using username and password" do
|
32
|
-
GoodData.connect(ConnectionHelper::DEFAULT_USERNAME, ConnectionHelper::DEFAULT_PASSWORD)
|
33
|
-
|
31
|
+
c = GoodData.connect(ConnectionHelper::DEFAULT_USERNAME, ConnectionHelper::DEFAULT_PASSWORD)
|
32
|
+
c.disconnect
|
34
33
|
end
|
35
34
|
end
|
36
35
|
|
@@ -49,7 +48,7 @@ describe GoodData::Connection do
|
|
49
48
|
:password => ConnectionHelper::DEFAULT_PASSWORD
|
50
49
|
}
|
51
50
|
GoodData.create_authenticated_connection(opts)
|
52
|
-
|
51
|
+
ConnectionHelper.disconnect
|
53
52
|
end
|
54
53
|
end
|
55
54
|
end
|
@@ -1,17 +1,16 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
3
|
require 'gooddata/connection'
|
4
|
-
require 'gooddata/core/connection'
|
5
4
|
require 'gooddata/core/project'
|
6
5
|
require 'gooddata/models/project'
|
7
6
|
|
8
7
|
describe 'GoodData - project' do
|
9
8
|
before(:each) do
|
10
|
-
ConnectionHelper.create_default_connection
|
9
|
+
@client = ConnectionHelper.create_default_connection
|
11
10
|
end
|
12
11
|
|
13
12
|
after(:each) do
|
14
|
-
|
13
|
+
@client.disconnect
|
15
14
|
end
|
16
15
|
|
17
16
|
describe '#project=' do
|
@@ -20,20 +19,25 @@ describe 'GoodData - project' do
|
|
20
19
|
end
|
21
20
|
|
22
21
|
it 'Assigns project using project ID' do
|
22
|
+
pending 'GoodData::project= is disabled for now'
|
23
23
|
GoodData.project = ProjectHelper::PROJECT_ID
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'Assigns project using project URL' do
|
27
|
+
pending 'GoodData::project= is disabled for now'
|
27
28
|
GoodData.project = ProjectHelper::PROJECT_URL
|
28
29
|
end
|
29
30
|
|
30
31
|
it 'Assigns project directly' do
|
32
|
+
pending 'GoodData::project= is disabled for now'
|
31
33
|
GoodData.project = GoodData::Project[ProjectHelper::PROJECT_ID]
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
35
37
|
describe '#project' do
|
36
38
|
it 'Returns project assigned' do
|
39
|
+
pending 'GoodData.project= is disabled for now'
|
40
|
+
|
37
41
|
GoodData.project = nil
|
38
42
|
GoodData.project.should == nil
|
39
43
|
|
@@ -44,7 +48,7 @@ describe 'GoodData - project' do
|
|
44
48
|
|
45
49
|
describe '#with_project' do
|
46
50
|
it 'Uses project specified' do
|
47
|
-
GoodData.with_project GoodData::Project[ProjectHelper::PROJECT_ID] do
|
51
|
+
GoodData.with_project GoodData::Project[ProjectHelper::PROJECT_ID, :client => @client] do
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
data/spec/unit/core/rest_spec.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
|
3
|
-
require 'gooddata/core/connection'
|
4
3
|
require 'gooddata/core/rest'
|
5
4
|
|
6
5
|
describe GoodData do
|
7
6
|
before(:each) do
|
8
|
-
ConnectionHelper.create_default_connection
|
7
|
+
@client = ConnectionHelper.create_default_connection
|
8
|
+
@project = ProjectHelper.get_default_project(:client => @client)
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
12
|
-
|
12
|
+
@client.disconnect
|
13
13
|
end
|
14
14
|
|
15
15
|
describe '#get_project_webdav_path' do
|
16
16
|
it 'Returns path' do
|
17
|
-
|
17
|
+
@client.get_project_webdav_path('test-file.csv', :project => @project)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe '#upload_to_project_webdav' do
|
22
22
|
it 'Uploads file' do
|
23
23
|
pending('Research how to properly upload file')
|
24
|
-
|
24
|
+
@client.upload_to_project_webdav('spec/data/test-ci-data.csv', :project => @project)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
28
|
describe '#get_user_webdav_path' do
|
29
29
|
it 'Gets the path' do
|
30
|
-
|
30
|
+
@client.get_user_webdav_path('test.csv', :project => @project)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -4,16 +4,23 @@ require 'gooddata/models/domain'
|
|
4
4
|
|
5
5
|
describe GoodData::Domain do
|
6
6
|
before(:each) do
|
7
|
-
ConnectionHelper.create_default_connection
|
7
|
+
@client = ConnectionHelper.create_default_connection
|
8
8
|
end
|
9
9
|
|
10
10
|
after(:each) do
|
11
|
-
|
11
|
+
@client.disconnect
|
12
12
|
end
|
13
13
|
|
14
14
|
describe '#add_user' do
|
15
15
|
it 'Should add user' do
|
16
|
-
|
16
|
+
args = {
|
17
|
+
:domain => ConnectionHelper::DEFAULT_DOMAIN,
|
18
|
+
:login => "gemtest#{rand(1e6)}@gooddata.com",
|
19
|
+
:password => CryptoHelper.generate_password,
|
20
|
+
:client => @client
|
21
|
+
}
|
22
|
+
|
23
|
+
user = GoodData::Domain.add_user(args)
|
17
24
|
expect(user).to be_an_instance_of(GoodData::Profile)
|
18
25
|
user.delete
|
19
26
|
end
|
@@ -21,7 +28,7 @@ describe GoodData::Domain do
|
|
21
28
|
|
22
29
|
describe '#users' do
|
23
30
|
it 'Should list users' do
|
24
|
-
users = GoodData::Domain.users(ConnectionHelper::DEFAULT_DOMAIN)
|
31
|
+
users = GoodData::Domain.users(ConnectionHelper::DEFAULT_DOMAIN, :client => @client)
|
25
32
|
expect(users).to be_instance_of(Array)
|
26
33
|
users.each do |user|
|
27
34
|
expect(user).to be_an_instance_of(GoodData::Profile)
|
@@ -29,7 +36,7 @@ describe GoodData::Domain do
|
|
29
36
|
end
|
30
37
|
|
31
38
|
it 'Accepts pagination options - limit' do
|
32
|
-
users = GoodData::Domain.users(ConnectionHelper::DEFAULT_DOMAIN, {:limit =>1})
|
39
|
+
users = GoodData::Domain.users(ConnectionHelper::DEFAULT_DOMAIN, {:client => @client, :limit =>1})
|
33
40
|
expect(users).to be_instance_of(Array)
|
34
41
|
users.each do |user|
|
35
42
|
expect(user).to be_an_instance_of(GoodData::Profile)
|
@@ -37,7 +44,7 @@ describe GoodData::Domain do
|
|
37
44
|
end
|
38
45
|
|
39
46
|
it 'Accepts pagination options - offset' do
|
40
|
-
users = GoodData::Domain.users(ConnectionHelper::DEFAULT_DOMAIN, {:offset => 1})
|
47
|
+
users = GoodData::Domain.users(ConnectionHelper::DEFAULT_DOMAIN, {:client => @client, :offset => 1})
|
41
48
|
expect(users).to be_instance_of(Array)
|
42
49
|
users.each do |user|
|
43
50
|
expect(user).to be_an_instance_of(GoodData::Profile)
|
@@ -76,7 +83,7 @@ describe GoodData::Domain do
|
|
76
83
|
list << user
|
77
84
|
end
|
78
85
|
|
79
|
-
res = GoodData::Domain.users_create(list, ConnectionHelper::DEFAULT_DOMAIN)
|
86
|
+
res = GoodData::Domain.users_create(list, ConnectionHelper::DEFAULT_DOMAIN, :client => @client)
|
80
87
|
|
81
88
|
expect(res).to be_an_instance_of(Array)
|
82
89
|
res.each do |r|
|
@@ -4,10 +4,10 @@ require 'gooddata/models/invitation'
|
|
4
4
|
|
5
5
|
describe GoodData::Invitation do
|
6
6
|
before(:each) do
|
7
|
-
ConnectionHelper.create_default_connection
|
7
|
+
@client = ConnectionHelper.create_default_connection
|
8
8
|
end
|
9
9
|
|
10
10
|
after(:each) do
|
11
|
-
|
11
|
+
@client.disconnect
|
12
12
|
end
|
13
13
|
end
|
@@ -6,10 +6,10 @@ require 'gooddata/models/project_role'
|
|
6
6
|
|
7
7
|
describe GoodData::Membership do
|
8
8
|
before(:all) do
|
9
|
-
ConnectionHelper.create_default_connection
|
9
|
+
@client = ConnectionHelper.create_default_connection
|
10
10
|
|
11
11
|
@users = [
|
12
|
-
GoodData::Membership
|
12
|
+
@client.create(GoodData::Membership,
|
13
13
|
{
|
14
14
|
'user' => {
|
15
15
|
'content' => {
|
@@ -35,7 +35,7 @@ describe GoodData::Membership do
|
|
35
35
|
}
|
36
36
|
),
|
37
37
|
|
38
|
-
GoodData::Membership
|
38
|
+
@client.create(GoodData::Membership,
|
39
39
|
{
|
40
40
|
'user' => {
|
41
41
|
'content' => {
|
@@ -48,7 +48,7 @@ describe GoodData::Membership do
|
|
48
48
|
}
|
49
49
|
),
|
50
50
|
|
51
|
-
GoodData::Membership
|
51
|
+
@client.create(GoodData::Membership,
|
52
52
|
{
|
53
53
|
'user' => {
|
54
54
|
'content' => {
|
@@ -64,7 +64,7 @@ describe GoodData::Membership do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
after(:all) do
|
67
|
-
|
67
|
+
@client.disconnect
|
68
68
|
end
|
69
69
|
|
70
70
|
describe '#diff_list' do
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'gooddata/models/metadata/metric'
|
4
|
+
|
5
|
+
describe GoodData::Metric do
|
6
|
+
|
7
|
+
|
8
|
+
RAW_DATA2 = {'metric' =>
|
9
|
+
{'content' =>
|
10
|
+
{'format' => '#,##0',
|
11
|
+
'expression' => 'SELECT SUM([/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/700])'},
|
12
|
+
'meta' =>
|
13
|
+
{'author' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248',
|
14
|
+
'uri' => '/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/70',
|
15
|
+
'tags' => 'a b cg r t',
|
16
|
+
'created' => '2014-04-30 22:47:57',
|
17
|
+
'identifier' => 'afo7bx1VakCz',
|
18
|
+
'deprecated' => '0',
|
19
|
+
'summary' => '',
|
20
|
+
'title' => 'sum of Lines changed',
|
21
|
+
'category' => 'metric',
|
22
|
+
'updated' => '2014-05-05 20:00:42',
|
23
|
+
'contributor' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248'}}}
|
24
|
+
|
25
|
+
RAW_DATA3 = {'metric' =>
|
26
|
+
{'content' =>
|
27
|
+
{'format' => '#,##0',
|
28
|
+
'expression' => 'SELECT SUM([/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/710])'},
|
29
|
+
'meta' =>
|
30
|
+
{'author' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248',
|
31
|
+
'uri' => '/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/71',
|
32
|
+
'tags' => 'a b cg r t',
|
33
|
+
'created' => '2014-04-30 22:47:57',
|
34
|
+
'identifier' => 'afo7bx1VakCz',
|
35
|
+
'deprecated' => '0',
|
36
|
+
'summary' => '',
|
37
|
+
'title' => 'sum of Lines changed',
|
38
|
+
'category' => 'metric',
|
39
|
+
'updated' => '2014-05-05 20:00:42',
|
40
|
+
'contributor' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248'}}}
|
41
|
+
|
42
|
+
USED_METRIC = GoodData::Metric.new(RAW_DATA2)
|
43
|
+
UNUSED_METRIC = GoodData::Metric.new(RAW_DATA3)
|
44
|
+
|
45
|
+
RAW_DATA = {'metric' =>
|
46
|
+
{'content' =>
|
47
|
+
{'format' => '#,##0',
|
48
|
+
'expression' =>
|
49
|
+
"SELECT SUM([#{USED_METRIC.uri})"},
|
50
|
+
'meta' =>
|
51
|
+
{'author' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248',
|
52
|
+
'uri' => '/gdc/md/ksjy0nr3goz6k8yrpklz97l0mych7nez/obj/252',
|
53
|
+
'tags' => 'a b cg r t',
|
54
|
+
'created' => '2014-04-30 22:47:57',
|
55
|
+
'identifier' => 'afo7bx1VakCz',
|
56
|
+
'deprecated' => '0',
|
57
|
+
'summary' => '',
|
58
|
+
'title' => 'sum of Lines changed',
|
59
|
+
'category' => 'metric',
|
60
|
+
'updated' => '2014-05-05 20:00:42',
|
61
|
+
'contributor' => '/gdc/account/profile/4e1e8cacc4989228e0ae531b30853248'}}}
|
62
|
+
|
63
|
+
before(:each) do
|
64
|
+
@instance = GoodData::Metric.new(RAW_DATA)
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#contain?' do
|
68
|
+
it 'should say it contains a depending metric if it does' do
|
69
|
+
@instance.contain?(USED_METRIC).should == true
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should say it contains a depending object which is given as a string if it does' do
|
73
|
+
@instance.contain?(USED_METRIC).should == true
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should be able to replace an object if the object is used in the expression' do
|
77
|
+
pending('resolve mutating constant if I init from it')
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should be able to return an expression of the metric' do
|
81
|
+
@instance.expression.should == "SELECT SUM([#{USED_METRIC.uri})"
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'should be able to replace an object if the object is used in the expression' do
|
85
|
+
@instance.contain?(USED_METRIC).should == true
|
86
|
+
@instance.contain?(UNUSED_METRIC).should == false
|
87
|
+
@instance.replace(USED_METRIC, UNUSED_METRIC)
|
88
|
+
@instance.contain?(USED_METRIC).should == false
|
89
|
+
@instance.contain?(UNUSED_METRIC).should == true
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|