gooddata 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -2,34 +2,35 @@ require 'gooddata'
|
|
|
2
2
|
|
|
3
3
|
describe "Spin a project", :constraint => 'slow' do
|
|
4
4
|
before(:all) do
|
|
5
|
+
@client = ConnectionHelper.create_default_connection
|
|
6
|
+
|
|
5
7
|
spec = MultiJson.load(File.read("./spec/data/test_project_model_spec.json"), :symbolize_keys => true)
|
|
6
|
-
ConnectionHelper::create_default_connection
|
|
7
8
|
|
|
8
|
-
@source_project = GoodData::Model::ProjectCreator.migrate({:spec => spec, :token => ConnectionHelper::GD_PROJECT_TOKEN})
|
|
9
|
-
@target_project = GoodData::Model::ProjectCreator.migrate({:spec => spec, :token => ConnectionHelper::GD_PROJECT_TOKEN})
|
|
9
|
+
@source_project = GoodData::Model::ProjectCreator.migrate({:spec => spec, :token => ConnectionHelper::GD_PROJECT_TOKEN, :client => @client})
|
|
10
|
+
@target_project = GoodData::Model::ProjectCreator.migrate({:spec => spec, :token => ConnectionHelper::GD_PROJECT_TOKEN, :client => @client})
|
|
10
11
|
end
|
|
11
12
|
|
|
12
13
|
after(:all) do
|
|
13
14
|
@source_project.delete unless @source_project.nil?
|
|
14
15
|
@target_project.delete unless @target_project.nil?
|
|
16
|
+
|
|
17
|
+
@client.disconnect
|
|
15
18
|
end
|
|
16
19
|
|
|
17
20
|
it "should transfer a metric" do
|
|
18
|
-
GoodData.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
GoodData.with_project(@target_project) {|p| GoodData::Metric[:all].count.should == 0}
|
|
25
|
-
p.partial_md_export([metric.uri], :project => @target_project)
|
|
26
|
-
GoodData.with_project(@target_project) do |p|
|
|
27
|
-
GoodData::Metric[:all].count.should == 1
|
|
28
|
-
metric = GoodData::Metric.find_first_by_title(metric_title)
|
|
29
|
-
metric.should_not be_nil
|
|
30
|
-
metric.title.should == metric_title
|
|
31
|
-
end
|
|
21
|
+
f = GoodData::Fact.find_first_by_title('Lines Changed', :client => @client, :project => @source_project)
|
|
22
|
+
metric_title = "Testing metric to be exported"
|
|
23
|
+
metric = GoodData::Metric.xcreate("SELECT SUM(#\"#{f.title}\")", :title => metric_title, :client => @client, :project => @source_project)
|
|
24
|
+
metric.save
|
|
25
|
+
|
|
26
|
+
GoodData.with_project(@target_project) { |p| GoodData::Metric[:all, :client => @client, :project => @target_project].count.should == 0 }
|
|
32
27
|
|
|
28
|
+
@source_project.partial_md_export(metric, :client => @client, :project => @target_project)
|
|
29
|
+
GoodData.with_project(@target_project) do |_p|
|
|
30
|
+
GoodData::Metric[:all, :client => @client, :project => @target_project].count.should == 1
|
|
31
|
+
metric = GoodData::Metric.find_first_by_title(metric_title, :client => @client, :project => @target_project)
|
|
32
|
+
metric.should_not be_nil
|
|
33
|
+
metric.title.should == metric_title
|
|
33
34
|
end
|
|
34
35
|
end
|
|
35
36
|
|
|
@@ -3,16 +3,25 @@
|
|
|
3
3
|
require 'gooddata'
|
|
4
4
|
require 'pry'
|
|
5
5
|
|
|
6
|
-
describe GoodData::Connection, :constraint => 'slow' do
|
|
6
|
+
describe GoodData::Rest::Connection, :constraint => 'slow' do
|
|
7
7
|
|
|
8
8
|
it "should log in and disconnect" do
|
|
9
|
-
ConnectionHelper::create_default_connection
|
|
10
|
-
|
|
9
|
+
client = ConnectionHelper::create_default_connection
|
|
10
|
+
expect(client).to be_kind_of(GoodData::Rest::Client)
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
conn.connected?.should == false
|
|
12
|
+
client.get("/gdc/md")
|
|
13
|
+
|
|
14
|
+
client.disconnect
|
|
16
15
|
end
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
it "should log in and disconnect with SST" do
|
|
18
|
+
regular_client = ConnectionHelper::create_default_connection
|
|
19
|
+
sst = regular_client.connection.sst_token
|
|
20
|
+
|
|
21
|
+
sst_client = GoodData.connect(sst_token: sst)
|
|
22
|
+
expect(sst_client.projects.count).to be > 0
|
|
23
|
+
sst_client.disconnect
|
|
24
|
+
|
|
25
|
+
regular_client.disconnect
|
|
26
|
+
end
|
|
27
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# encoding: UTF-8
|
|
2
2
|
|
|
3
3
|
require 'simplecov'
|
|
4
|
+
require 'pmap'
|
|
4
5
|
require 'rspec'
|
|
5
6
|
require 'coveralls'
|
|
6
7
|
require 'pathname'
|
|
@@ -20,6 +21,7 @@ RSpec.configure do |config|
|
|
|
20
21
|
config.include ConnectionHelper
|
|
21
22
|
config.include CryptoHelper
|
|
22
23
|
config.include CsvHelper
|
|
24
|
+
config.include ProcessHelper
|
|
23
25
|
config.include ProjectHelper
|
|
24
26
|
# config.include SchemaHelper
|
|
25
27
|
|
|
@@ -29,8 +31,8 @@ RSpec.configure do |config|
|
|
|
29
31
|
# TODO: Move this to some method.
|
|
30
32
|
# TODO Make more intelligent so two test suites can run at the same time.
|
|
31
33
|
# ConnectionHelper.create_default_connection
|
|
32
|
-
# users = GoodData::Domain.
|
|
33
|
-
# users.
|
|
34
|
+
# users = GoodData::Domain.users(ConnectionHelper::DEFAULT_DOMAIN)
|
|
35
|
+
# users.pmap do |user|
|
|
34
36
|
# user.delete if user.email != ConnectionHelper::DEFAULT_USERNAME
|
|
35
37
|
# end
|
|
36
38
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'gooddata/cli/cli'
|
|
4
4
|
|
|
5
|
-
describe 'GoodData::CLI - domain' do
|
|
5
|
+
describe 'GoodData::CLI - domain', :broken => true do
|
|
6
6
|
describe 'domain' do
|
|
7
7
|
it 'Complains when no subcommand specified' do
|
|
8
8
|
args = %w(domain)
|
|
@@ -18,7 +18,14 @@ describe 'GoodData::CLI - domain' do
|
|
|
18
18
|
TEST_PASSWORD = 'p4ssw0rth'
|
|
19
19
|
|
|
20
20
|
it "Outputs 'Domain name has to be provided' if none specified" do
|
|
21
|
-
args =
|
|
21
|
+
args = [
|
|
22
|
+
'-U',
|
|
23
|
+
ConnectionHelper::DEFAULT_USERNAME,
|
|
24
|
+
'-P',
|
|
25
|
+
ConnectionHelper::DEFAULT_PASSWORD,
|
|
26
|
+
'domain',
|
|
27
|
+
'add_user'
|
|
28
|
+
]
|
|
22
29
|
|
|
23
30
|
out = run_cli(args)
|
|
24
31
|
out.should include 'Domain name has to be provided'
|
|
@@ -26,6 +33,10 @@ describe 'GoodData::CLI - domain' do
|
|
|
26
33
|
|
|
27
34
|
it "Outputs 'Email has to be provided' if none specified" do
|
|
28
35
|
args = [
|
|
36
|
+
'-U',
|
|
37
|
+
ConnectionHelper::DEFAULT_USERNAME,
|
|
38
|
+
'-P',
|
|
39
|
+
ConnectionHelper::DEFAULT_PASSWORD,
|
|
29
40
|
'domain',
|
|
30
41
|
'add_user',
|
|
31
42
|
TEST_DOMAIN
|
|
@@ -37,6 +48,10 @@ describe 'GoodData::CLI - domain' do
|
|
|
37
48
|
|
|
38
49
|
it "Outputs 'Password has to be provided' if none specified" do
|
|
39
50
|
args = [
|
|
51
|
+
'-U',
|
|
52
|
+
ConnectionHelper::DEFAULT_USERNAME,
|
|
53
|
+
'-P',
|
|
54
|
+
ConnectionHelper::DEFAULT_PASSWORD,
|
|
40
55
|
'domain',
|
|
41
56
|
'add_user',
|
|
42
57
|
TEST_DOMAIN,
|
|
@@ -49,6 +64,10 @@ describe 'GoodData::CLI - domain' do
|
|
|
49
64
|
|
|
50
65
|
it 'Works' do
|
|
51
66
|
args = [
|
|
67
|
+
'-U',
|
|
68
|
+
ConnectionHelper::DEFAULT_USERNAME,
|
|
69
|
+
'-P',
|
|
70
|
+
ConnectionHelper::DEFAULT_PASSWORD,
|
|
52
71
|
'domain',
|
|
53
72
|
'add_user',
|
|
54
73
|
TEST_DOMAIN,
|
|
@@ -63,7 +82,14 @@ describe 'GoodData::CLI - domain' do
|
|
|
63
82
|
|
|
64
83
|
describe 'domain list_users' do
|
|
65
84
|
it 'Complains when no parameters specified' do
|
|
66
|
-
args =
|
|
85
|
+
args = [
|
|
86
|
+
'-U',
|
|
87
|
+
ConnectionHelper::DEFAULT_USERNAME,
|
|
88
|
+
'-P',
|
|
89
|
+
ConnectionHelper::DEFAULT_PASSWORD,
|
|
90
|
+
'domain',
|
|
91
|
+
'list_users'
|
|
92
|
+
]
|
|
67
93
|
|
|
68
94
|
out = run_cli(args)
|
|
69
95
|
out.should include 'Domain name has to be provided'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'gooddata/cli/cli'
|
|
4
4
|
|
|
5
|
-
describe GoodData::CLI do
|
|
5
|
+
describe GoodData::CLI, :broken => true do
|
|
6
6
|
describe 'role' do
|
|
7
7
|
it 'Complains when no parameters specified' do
|
|
8
8
|
args = %w(role)
|
|
@@ -13,7 +13,14 @@ describe GoodData::CLI do
|
|
|
13
13
|
|
|
14
14
|
describe 'role list' do
|
|
15
15
|
it 'Complains when no project ID specified' do
|
|
16
|
-
args =
|
|
16
|
+
args = [
|
|
17
|
+
'-U',
|
|
18
|
+
ConnectionHelper::DEFAULT_USERNAME,
|
|
19
|
+
'-P',
|
|
20
|
+
ConnectionHelper::DEFAULT_PASSWORD,
|
|
21
|
+
'role',
|
|
22
|
+
'list'
|
|
23
|
+
]
|
|
17
24
|
|
|
18
25
|
out = run_cli(args)
|
|
19
26
|
out.should include 'Project ID has to be provided'
|
|
@@ -23,6 +30,10 @@ describe GoodData::CLI do
|
|
|
23
30
|
pending 'Investignate which project to use'
|
|
24
31
|
|
|
25
32
|
args = [
|
|
33
|
+
'-U',
|
|
34
|
+
ConnectionHelper::DEFAULT_USERNAME,
|
|
35
|
+
'-P',
|
|
36
|
+
ConnectionHelper::DEFAULT_PASSWORD,
|
|
26
37
|
'-p',
|
|
27
38
|
ProjectHelper::PROJECT_ID,
|
|
28
39
|
'role',
|
|
@@ -9,23 +9,4 @@ describe GoodData::Command::Api do
|
|
|
9
9
|
cmd = GoodData::Command::Api.new()
|
|
10
10
|
cmd.should be_a(GoodData::Command::Api)
|
|
11
11
|
end
|
|
12
|
-
|
|
13
|
-
describe "#get" do
|
|
14
|
-
it "Call without arguments" do
|
|
15
|
-
GoodData::Command::Api.test()
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
describe "#delete" do
|
|
20
|
-
it "Call without arguments" do
|
|
21
|
-
GoodData::Command::Api.test()
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
describe "#test" do
|
|
26
|
-
it "Call without arguments" do
|
|
27
|
-
GoodData::Command::Api.test()
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
12
|
end
|
|
@@ -2,9 +2,10 @@ require 'highline'
|
|
|
2
2
|
|
|
3
3
|
require 'gooddata/cli/terminal'
|
|
4
4
|
require 'gooddata/commands/auth'
|
|
5
|
+
require 'gooddata/helpers/auth_helpers'
|
|
5
6
|
|
|
6
7
|
describe GoodData::Command::Auth do
|
|
7
|
-
ORIG_TERMINAL = GoodData::CLI::DEFAULT_TERMINAL
|
|
8
|
+
ORIG_TERMINAL = GoodData::CLI::DEFAULT_TERMINAL unless const_defined?(:ORIG_TERMINAL)
|
|
8
9
|
|
|
9
10
|
DEFAULT_CREDENTIALS = {
|
|
10
11
|
:email => 'joedoe@example.com',
|
|
@@ -34,11 +35,11 @@ describe GoodData::Command::Auth do
|
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
before(:each) do
|
|
37
|
-
@
|
|
38
|
+
@client = ConnectionHelper::create_default_connection
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
after(:each) do
|
|
41
|
-
|
|
42
|
+
@client.disconnect
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
it "Is Possible to create GoodData::Command::Auth instance" do
|
|
@@ -48,7 +49,7 @@ describe GoodData::Command::Auth do
|
|
|
48
49
|
|
|
49
50
|
describe "#credentials_file" do
|
|
50
51
|
it "Returns credentials_file" do
|
|
51
|
-
GoodData::
|
|
52
|
+
GoodData::Helpers::AuthHelper.credentials_file
|
|
52
53
|
end
|
|
53
54
|
end
|
|
54
55
|
|
|
@@ -67,15 +68,15 @@ describe GoodData::Command::Auth do
|
|
|
67
68
|
|
|
68
69
|
describe "#read_credentials" do
|
|
69
70
|
it 'Reads credentials from default file if no path specified' do
|
|
70
|
-
GoodData::
|
|
71
|
+
GoodData::Helpers::AuthHelper.read_credentials
|
|
71
72
|
end
|
|
72
73
|
|
|
73
74
|
it 'Reads credentials from file specified' do
|
|
74
75
|
temp_path = Tempfile.new(DEFAULT_CREDENTIALS_TEMP_FILE_NAME).path
|
|
75
76
|
|
|
76
|
-
GoodData::
|
|
77
|
+
result = GoodData::Helpers::AuthHelper.write_credentials(DEFAULT_CREDENTIALS, temp_path)
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
GoodData::Helpers::AuthHelper.read_credentials(temp_path)
|
|
79
80
|
GoodData::Command::Auth.unstore(temp_path)
|
|
80
81
|
|
|
81
82
|
result.should == DEFAULT_CREDENTIALS
|
|
@@ -83,7 +84,7 @@ describe GoodData::Command::Auth do
|
|
|
83
84
|
|
|
84
85
|
it 'Returns empty hash if invalid path specified' do
|
|
85
86
|
expect = {}
|
|
86
|
-
result = GoodData::
|
|
87
|
+
result = GoodData::Helpers::AuthHelper.read_credentials('/some/invalid/path')
|
|
87
88
|
result.should == expect
|
|
88
89
|
end
|
|
89
90
|
end
|
|
@@ -92,7 +93,7 @@ describe GoodData::Command::Auth do
|
|
|
92
93
|
it 'Writes credentials' do
|
|
93
94
|
temp_path = Tempfile.new(DEFAULT_CREDENTIALS_TEMP_FILE_NAME).path
|
|
94
95
|
|
|
95
|
-
result = GoodData::
|
|
96
|
+
result = GoodData::Helpers::AuthHelper.write_credentials(DEFAULT_CREDENTIALS, temp_path)
|
|
96
97
|
GoodData::Command::Auth.unstore(temp_path)
|
|
97
98
|
|
|
98
99
|
result.should == DEFAULT_CREDENTIALS
|
|
@@ -101,6 +102,8 @@ describe GoodData::Command::Auth do
|
|
|
101
102
|
|
|
102
103
|
describe "#store" do
|
|
103
104
|
it 'Stores credentials' do
|
|
105
|
+
pending("Mock STDIO")
|
|
106
|
+
|
|
104
107
|
@input.string = ''
|
|
105
108
|
@input << DEFAULT_CREDENTIALS[:email] << "\n"
|
|
106
109
|
@input << DEFAULT_CREDENTIALS[:password] << "\n"
|
|
@@ -114,6 +117,8 @@ describe GoodData::Command::Auth do
|
|
|
114
117
|
end
|
|
115
118
|
|
|
116
119
|
it 'Overwrites credentials if confirmed' do
|
|
120
|
+
pending("Mock STDIO")
|
|
121
|
+
|
|
117
122
|
@input.string = ''
|
|
118
123
|
@input << DEFAULT_CREDENTIALS[:email] << "\n"
|
|
119
124
|
@input << DEFAULT_CREDENTIALS[:password] << "\n"
|
|
@@ -122,12 +127,14 @@ describe GoodData::Command::Auth do
|
|
|
122
127
|
@input.rewind
|
|
123
128
|
|
|
124
129
|
temp_path = Tempfile.new(DEFAULT_CREDENTIALS_TEMP_FILE_NAME).path
|
|
125
|
-
GoodData::
|
|
130
|
+
GoodData::Helpers::AuthHelper.write_credentials(DEFAULT_CREDENTIALS, temp_path)
|
|
126
131
|
|
|
127
132
|
GoodData::Command::Auth.store(temp_path)
|
|
128
133
|
end
|
|
129
134
|
|
|
130
135
|
it 'Do not overwrites credentials if not confirmed' do
|
|
136
|
+
pending("Mock STDIO")
|
|
137
|
+
|
|
131
138
|
@input.string = ''
|
|
132
139
|
@input << DEFAULT_CREDENTIALS_OVER[:email] << "\n"
|
|
133
140
|
@input << DEFAULT_CREDENTIALS_OVER[:password] << "\n"
|
|
@@ -136,10 +143,10 @@ describe GoodData::Command::Auth do
|
|
|
136
143
|
@input.rewind
|
|
137
144
|
|
|
138
145
|
temp_path = Tempfile.new(DEFAULT_CREDENTIALS_TEMP_FILE_NAME).path
|
|
139
|
-
GoodData::
|
|
146
|
+
GoodData::Helpers::AuthHelper.write_credentials(DEFAULT_CREDENTIALS, temp_path)
|
|
140
147
|
|
|
141
148
|
GoodData::Command::Auth.store(temp_path)
|
|
142
|
-
result = GoodData::
|
|
149
|
+
result = GoodData::Helpers::AuthHelper.read_credentials(temp_path)
|
|
143
150
|
|
|
144
151
|
result.should == DEFAULT_CREDENTIALS
|
|
145
152
|
end
|
|
@@ -148,7 +155,7 @@ describe GoodData::Command::Auth do
|
|
|
148
155
|
describe "#unstore" do
|
|
149
156
|
it 'Removes stored credentials' do
|
|
150
157
|
temp_path = Tempfile.new(DEFAULT_CREDENTIALS_TEMP_FILE_NAME).path
|
|
151
|
-
GoodData::
|
|
158
|
+
GoodData::Helpers::AuthHelper.write_credentials(DEFAULT_CREDENTIALS, temp_path)
|
|
152
159
|
GoodData::Command::Auth.unstore(temp_path)
|
|
153
160
|
end
|
|
154
161
|
end
|
|
@@ -2,12 +2,12 @@ require 'gooddata/commands/datasets'
|
|
|
2
2
|
|
|
3
3
|
describe GoodData::Command::Datasets do
|
|
4
4
|
before(:each) do
|
|
5
|
-
ConnectionHelper::create_default_connection
|
|
5
|
+
@client = ConnectionHelper::create_default_connection
|
|
6
6
|
@cmd = GoodData::Command::Datasets.new()
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
after(:each) do
|
|
10
|
-
|
|
10
|
+
@client.disconnect
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
it "Is Possible to create GoodData::Command::Datasets instance" do
|