gooddata 0.6.0 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/.rubocop.yml +23 -0
- data/.travis.yml +9 -4
- data/CLI.md +439 -0
- data/Gemfile +0 -1
- data/README.md +2 -2
- data/Rakefile +60 -8
- data/doc/templates/default/module/setup.rb +1 -1
- data/examples.rb +2 -0
- data/gooddata +2 -0
- data/gooddata.gemspec +12 -8
- data/lib/gooddata.rb +0 -2
- data/lib/gooddata/bricks/base_downloader.rb +52 -47
- data/lib/gooddata/bricks/brick.rb +20 -31
- data/lib/gooddata/bricks/bricks.rb +1 -1
- data/lib/gooddata/bricks/middleware/base_middleware.rb +9 -7
- data/lib/gooddata/bricks/middleware/bench_middleware.rb +12 -10
- data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +28 -28
- data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +20 -16
- data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +21 -19
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +10 -8
- data/lib/gooddata/bricks/middleware/restforce_middleware.rb +36 -34
- data/lib/gooddata/bricks/middleware/stdout_middleware.rb +11 -9
- data/lib/gooddata/bricks/middleware/twitter_middleware.rb +14 -12
- data/lib/gooddata/bricks/pipeline.rb +28 -0
- data/lib/gooddata/bricks/utils.rb +10 -8
- data/lib/gooddata/cli/cli.rb +1 -6
- data/lib/gooddata/cli/commands/auth_cmd.rb +1 -1
- data/lib/gooddata/cli/commands/console_cmd.rb +7 -5
- data/lib/gooddata/cli/commands/domain_cmd.rb +45 -0
- data/lib/gooddata/cli/commands/process_cmd.rb +42 -5
- data/lib/gooddata/cli/commands/project_cmd.rb +96 -36
- data/lib/gooddata/cli/commands/projects_cmd.rb +21 -0
- data/lib/gooddata/cli/commands/role_cmd.rb +28 -0
- data/lib/gooddata/cli/commands/run_ruby_cmd.rb +5 -5
- data/lib/gooddata/cli/commands/scaffold_cmd.rb +1 -1
- data/lib/gooddata/cli/commands/{profile_cmd.rb → user_cmd.rb} +7 -9
- data/lib/gooddata/cli/shared.rb +3 -2
- data/lib/gooddata/client.rb +16 -304
- data/lib/gooddata/commands/api.rb +13 -5
- data/lib/gooddata/commands/auth.rb +47 -40
- data/lib/gooddata/commands/base.rb +4 -2
- data/lib/gooddata/commands/commands.rb +1 -1
- data/lib/gooddata/commands/datasets.rb +20 -7
- data/lib/gooddata/commands/domain.rb +23 -0
- data/lib/gooddata/commands/process.rb +23 -117
- data/lib/gooddata/commands/project.rb +147 -0
- data/lib/gooddata/commands/projects.rb +8 -102
- data/lib/gooddata/commands/role.rb +26 -0
- data/lib/gooddata/commands/runners.rb +41 -38
- data/lib/gooddata/commands/scaffold.rb +46 -43
- data/lib/gooddata/commands/user.rb +33 -0
- data/lib/gooddata/connection.rb +43 -353
- data/lib/gooddata/core/connection.rb +389 -0
- data/lib/gooddata/core/core.rb +5 -4
- data/lib/gooddata/core/logging.rb +48 -0
- data/lib/gooddata/core/nil_logger.rb +13 -0
- data/lib/gooddata/core/project.rb +70 -0
- data/lib/gooddata/core/rest.rb +120 -0
- data/lib/gooddata/core/threaded.rb +14 -0
- data/lib/gooddata/core/user.rb +19 -0
- data/lib/gooddata/data/data.rb +2 -1
- data/lib/gooddata/data/guesser.rb +16 -12
- data/lib/gooddata/exceptions/command_failed.rb +1 -1
- data/lib/gooddata/exceptions/exceptions.rb +2 -1
- data/lib/gooddata/exceptions/no_project_error.rb +11 -0
- data/lib/gooddata/exceptions/project_not_found.rb +1 -1
- data/lib/gooddata/extensions/big_decimal.rb +6 -2
- data/lib/gooddata/extract.rb +10 -8
- data/lib/gooddata/goodzilla/goodzilla.rb +61 -59
- data/lib/gooddata/helpers.rb +15 -9
- data/lib/gooddata/models/account_settings.rb +124 -0
- data/lib/gooddata/models/attributes/anchor.rb +37 -0
- data/lib/gooddata/models/attributes/attributes.rb +8 -0
- data/lib/gooddata/models/attributes/date_attribute.rb +25 -0
- data/lib/gooddata/models/attributes/time_attribute.rb +24 -0
- data/lib/gooddata/models/columns/attribute.rb +71 -0
- data/lib/gooddata/models/columns/columns.rb +8 -0
- data/lib/gooddata/models/columns/date_column.rb +63 -0
- data/lib/gooddata/models/columns/fact_model.rb +54 -0
- data/lib/gooddata/models/columns/label.rb +55 -0
- data/lib/gooddata/models/columns/reference.rb +57 -0
- data/lib/gooddata/models/dashboard_builder.rb +26 -0
- data/lib/gooddata/models/data_result.rb +10 -9
- data/lib/gooddata/models/domain.rb +131 -0
- data/lib/gooddata/models/empty_result.rb +5 -8
- data/lib/gooddata/models/facts/facts.rb +8 -0
- data/lib/gooddata/models/facts/time_fact.rb +20 -0
- data/lib/gooddata/models/folders/attribute_folder.rb +20 -0
- data/lib/gooddata/models/folders/fact_folder.rb +20 -0
- data/lib/gooddata/models/folders/folders.rb +8 -0
- data/lib/gooddata/models/invitation.rb +78 -0
- data/lib/gooddata/models/links.rb +6 -6
- data/lib/gooddata/models/md_object.rb +25 -0
- data/lib/gooddata/models/metadata.rb +160 -62
- data/lib/gooddata/models/metadata/attribute.rb +81 -0
- data/lib/gooddata/models/metadata/column.rb +61 -0
- data/lib/gooddata/models/{dashboard.rb → metadata/dashboard.rb} +12 -7
- data/lib/gooddata/models/{data_set.rb → metadata/data_set.rb} +5 -4
- data/lib/gooddata/models/metadata/date_dimension.rb +26 -0
- data/lib/gooddata/models/metadata/display_form.rb +61 -0
- data/lib/gooddata/models/metadata/fact.rb +36 -0
- data/lib/gooddata/models/metadata/folder.rb +24 -0
- data/lib/gooddata/models/metadata/metadata.rb +8 -0
- data/lib/gooddata/models/metadata/metric.rb +197 -0
- data/lib/gooddata/models/metadata/report.rb +115 -0
- data/lib/gooddata/models/{report_definition.rb → metadata/report_definition.rb} +16 -10
- data/lib/gooddata/models/metadata/schema.rb +227 -0
- data/lib/gooddata/models/model.rb +38 -1339
- data/lib/gooddata/models/models.rb +5 -2
- data/lib/gooddata/models/module_constants.rb +29 -0
- data/lib/gooddata/models/process.rb +142 -13
- data/lib/gooddata/models/profile.rb +4 -6
- data/lib/gooddata/models/project.rb +406 -136
- data/lib/gooddata/models/project_blueprint.rb +221 -0
- data/lib/gooddata/models/project_builder.rb +136 -0
- data/lib/gooddata/models/project_creator.rb +138 -0
- data/lib/gooddata/models/project_metadata.rb +11 -10
- data/lib/gooddata/models/project_role.rb +92 -0
- data/lib/gooddata/models/references/date_reference.rb +44 -0
- data/lib/gooddata/models/references/references.rb +8 -0
- data/lib/gooddata/models/references/time_reference.rb +13 -0
- data/lib/gooddata/models/report_data_result.rb +11 -11
- data/lib/gooddata/models/schedule.rb +284 -0
- data/lib/gooddata/models/schema_blueprint.rb +158 -0
- data/lib/gooddata/models/schema_builder.rb +81 -0
- data/lib/gooddata/models/tab_builder.rb +23 -0
- data/lib/gooddata/models/user.rb +165 -0
- data/lib/gooddata/version.rb +1 -1
- data/lib/templates/project/data/devs.csv +1 -1
- data/lib/templates/project/data/repos.csv +1 -1
- data/lib/templates/project/model/model.rb.erb +7 -11
- data/spec/bricks/bricks_spec.rb +2 -0
- data/spec/data/test-ci-data.csv +2 -0
- data/spec/data/test_project_model_spec.json +7 -27
- data/spec/helpers/blueprint_helper.rb +2 -0
- data/spec/helpers/cli_helper.rb +2 -0
- data/spec/helpers/connection_helper.rb +14 -1
- data/spec/helpers/project_helper.rb +16 -0
- data/spec/helpers/schema_helper.rb +16 -0
- data/spec/integration/command_projects_spec.rb +7 -7
- data/spec/integration/create_from_template_spec.rb +2 -2
- data/spec/integration/full_project_spec.rb +160 -7
- data/spec/integration/partial_md_export_import_spec.rb +3 -3
- data/spec/logging_in_logging_out_spec.rb +2 -1
- data/spec/spec_helper.rb +26 -4
- data/spec/unit/bricks/bricks_spec.rb +15 -7
- data/spec/unit/bricks/middleware/bench_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/bulk_salesforce_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/gooddata_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/logger_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/restforce_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/stdout_middleware_spec.rb +2 -0
- data/spec/unit/bricks/middleware/twitter_middleware_spec.rb +2 -0
- data/spec/unit/cli/cli_spec.rb +2 -0
- data/spec/unit/cli/commands/cmd_api_spec.rb +23 -15
- data/spec/unit/cli/commands/cmd_auth_spec.rb +8 -4
- data/spec/unit/cli/commands/cmd_domain_spec.rb +82 -0
- data/spec/unit/cli/commands/cmd_process_spec.rb +29 -13
- data/spec/unit/cli/commands/cmd_project_spec.rb +51 -30
- data/spec/unit/cli/commands/cmd_role_spec.rb +44 -0
- data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +8 -4
- data/spec/unit/cli/commands/cmd_scaffold_spec.rb +48 -11
- data/spec/unit/cli/commands/cmd_user_spec.rb +29 -0
- data/spec/unit/commands/command_api_spec.rb +1 -1
- data/spec/unit/commands/command_auth_spec.rb +100 -18
- data/spec/unit/commands/command_dataset_spec.rb +4 -0
- data/spec/unit/commands/command_process_spec.rb +9 -4
- data/spec/unit/commands/command_projects_spec.rb +10 -6
- data/spec/unit/commands/command_scaffold_spec.rb +5 -1
- data/spec/unit/commands/command_user_spec.rb +22 -0
- data/spec/unit/core/connection_spec.rb +35 -6
- data/spec/unit/core/logging_spec.rb +65 -0
- data/spec/unit/core/nil_logger_spec.rb +9 -0
- data/spec/unit/core/project_spec.rb +51 -0
- data/spec/unit/core/rest_spec.rb +33 -0
- data/spec/unit/data/guesser_spec.rb +5 -0
- data/spec/unit/godzilla/goodzilla_spec.rb +2 -0
- data/spec/unit/models/account_settings_spec.rb +28 -0
- data/spec/unit/models/anchor_spec.rb +32 -0
- data/spec/unit/models/attribute_column_spec.rb +7 -0
- data/spec/unit/models/domain_spec.rb +45 -0
- data/spec/unit/models/invitation_spec.rb +13 -0
- data/spec/unit/models/md_object_spec.rb +47 -0
- data/spec/unit/models/metric.rb +92 -0
- data/spec/unit/{model → models}/model_spec.rb +9 -7
- data/spec/unit/models/project_blueprint_spec.rb +202 -0
- data/spec/unit/models/project_creator.rb +73 -0
- data/spec/unit/models/project_role_spec.rb +90 -0
- data/spec/unit/models/project_spec.rb +143 -0
- data/spec/unit/models/schedule_spec.rb +491 -0
- data/spec/unit/{model → models}/schema_builder_spec.rb +2 -0
- data/spec/unit/{model → models}/tools_spec.rb +13 -7
- data/spec/unit/models/user_spec.rb +16 -0
- data/test/test_upload.rb +2 -0
- metadata +189 -86
- data/lib/gooddata/commands/profile.rb +0 -11
- data/lib/gooddata/models/attribute.rb +0 -29
- data/lib/gooddata/models/display_form.rb +0 -9
- data/lib/gooddata/models/fact.rb +0 -19
- data/lib/gooddata/models/metric.rb +0 -99
- data/lib/gooddata/models/report.rb +0 -89
- data/spec/data/blueprint_valid.json +0 -37
- data/spec/unit/cli/commands/cmd_profile_spec.rb +0 -16
- data/spec/unit/commands/command_profile_spec.rb +0 -18
- data/spec/unit/core/core_spec.rb +0 -7
- data/spec/unit/model/blueprint_spec.rb +0 -132
- data/spec/unit/model/project_blueprint_spec.rb +0 -44
@@ -1,29 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require_relative 'metadata'
|
4
|
-
|
5
|
-
module GoodData
|
6
|
-
class Attribute < GoodData::MdObject
|
7
|
-
root_key :attribute
|
8
|
-
|
9
|
-
class << self
|
10
|
-
def [](id)
|
11
|
-
if id == :all
|
12
|
-
GoodData.get(GoodData.project.md['query'] + '/attributes/')['query']['entries']
|
13
|
-
else
|
14
|
-
super
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def display_forms
|
20
|
-
content['displayForms'].map { |df| GoodData::DisplayForm[df['meta']['uri']] }
|
21
|
-
end
|
22
|
-
|
23
|
-
alias :labels :display_forms
|
24
|
-
|
25
|
-
def is_attribute?
|
26
|
-
true
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/gooddata/models/fact.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require_relative 'metadata'
|
4
|
-
|
5
|
-
module GoodData
|
6
|
-
class Fact < GoodData::MdObject
|
7
|
-
root_key :fact
|
8
|
-
|
9
|
-
class << self
|
10
|
-
def [](id)
|
11
|
-
if id == :all
|
12
|
-
GoodData.get(GoodData.project.md['query'] + '/facts/')['query']['entries']
|
13
|
-
else
|
14
|
-
super
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require_relative 'metadata'
|
4
|
-
require_relative '../goodzilla/goodzilla'
|
5
|
-
|
6
|
-
module GoodData
|
7
|
-
# Metric representation
|
8
|
-
class Metric < GoodData::MdObject
|
9
|
-
root_key :metric
|
10
|
-
|
11
|
-
class << self
|
12
|
-
def [](id)
|
13
|
-
if id == :all
|
14
|
-
GoodData.get(GoodData.project.md['query'] + '/metrics/')['query']['entries']
|
15
|
-
else
|
16
|
-
super
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def xcreate(options)
|
21
|
-
if options.is_a?(String)
|
22
|
-
create({:expression => options, :extended_notation => true})
|
23
|
-
else
|
24
|
-
create(options.merge({:extended_notation => true}))
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def create(options={})
|
29
|
-
if options.is_a?(String)
|
30
|
-
expression = options
|
31
|
-
extended_notation = false
|
32
|
-
title = nil
|
33
|
-
else
|
34
|
-
title = options[:title]
|
35
|
-
summary = options[:summary]
|
36
|
-
expression = options[:expression] || fail('Metric has to have its expression defined')
|
37
|
-
extended_notation = options[:extended_notation] || false
|
38
|
-
end
|
39
|
-
|
40
|
-
expression = if extended_notation
|
41
|
-
dict = {
|
42
|
-
:facts => GoodData::Fact[:all].reduce({}) { |memo, item| memo[item['title']] = item['link']; memo },
|
43
|
-
:attributes => GoodData::Attribute[:all].reduce({}) { |memo, item| memo[item['title']] = item['link']; memo },
|
44
|
-
:metrics => GoodData::Metric[:all].reduce({}) { |memo, item| memo[item['title']] = item['link']; memo },
|
45
|
-
}
|
46
|
-
interpolated_metric = GoodData::SmallGoodZilla.interpolate_metric(expression, dict)
|
47
|
-
interpolated_metric
|
48
|
-
else
|
49
|
-
expression
|
50
|
-
end
|
51
|
-
|
52
|
-
Metric.new({
|
53
|
-
'metric' => {
|
54
|
-
'content' => {
|
55
|
-
'format' => '#,##0',
|
56
|
-
'expression' => expression
|
57
|
-
},
|
58
|
-
'meta' => {
|
59
|
-
'tags' => '',
|
60
|
-
'summary' => summary,
|
61
|
-
'title' => title,
|
62
|
-
}
|
63
|
-
}
|
64
|
-
})
|
65
|
-
end
|
66
|
-
|
67
|
-
def execute(expression, options={})
|
68
|
-
m = if expression.is_a?(String)
|
69
|
-
GoodData::Metric.create({:title => 'Temporary metric to be deleted', :expression => expression}.merge(options))
|
70
|
-
else
|
71
|
-
GoodData::Metric.create({:title => 'Temporary metric to be deleted'}.merge(expression))
|
72
|
-
end
|
73
|
-
m.execute
|
74
|
-
end
|
75
|
-
|
76
|
-
def xexecute(expression)
|
77
|
-
if expression.is_a?(String)
|
78
|
-
execute({:expression => expression, :extended_notation => true})
|
79
|
-
else
|
80
|
-
execute(expression.merge({:extended_notation => true}))
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def execute
|
86
|
-
res = GoodData::ReportDefinition.execute(:left => self)
|
87
|
-
res[0][0]
|
88
|
-
end
|
89
|
-
|
90
|
-
def validate
|
91
|
-
fail 'Meric needs to have title' if title.nil?
|
92
|
-
true
|
93
|
-
end
|
94
|
-
|
95
|
-
def is_metric?
|
96
|
-
true
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
@@ -1,89 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require_relative 'metadata'
|
4
|
-
|
5
|
-
module GoodData
|
6
|
-
class Report < GoodData::MdObject
|
7
|
-
root_key :report
|
8
|
-
|
9
|
-
class << self
|
10
|
-
def [](id)
|
11
|
-
if id == :all
|
12
|
-
uri = GoodData.project.md['query'] + '/reports/'
|
13
|
-
GoodData.get(uri)['query']['entries']
|
14
|
-
else
|
15
|
-
super
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def create(options={})
|
20
|
-
title = options[:title]
|
21
|
-
summary = options[:summary] || ''
|
22
|
-
rd = options[:rd] || ReportDefinition.create(:top => options[:top], :left => options[:left])
|
23
|
-
rd.save
|
24
|
-
|
25
|
-
report = Report.new({
|
26
|
-
'report' => {
|
27
|
-
'content' => {
|
28
|
-
'domains' => [],
|
29
|
-
'definitions' => [rd.uri]
|
30
|
-
},
|
31
|
-
'meta' => {
|
32
|
-
'tags' => '',
|
33
|
-
'deprecated' => '0',
|
34
|
-
'summary' => summary,
|
35
|
-
'title' => title
|
36
|
-
}
|
37
|
-
}
|
38
|
-
})
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def results
|
43
|
-
content['results']
|
44
|
-
end
|
45
|
-
|
46
|
-
def get_latest_report_definition_uri
|
47
|
-
report_result = get_latest_report_result
|
48
|
-
report_result.content['reportDefinition']
|
49
|
-
end
|
50
|
-
|
51
|
-
def get_latest_report_definition
|
52
|
-
GoodData::MdObject[get_latest_report_definition_uri]
|
53
|
-
end
|
54
|
-
|
55
|
-
def get_latest_report_result_uri
|
56
|
-
results.last
|
57
|
-
end
|
58
|
-
|
59
|
-
def get_latest_report_result
|
60
|
-
GoodData::MdObject[get_latest_report_result_uri]
|
61
|
-
end
|
62
|
-
|
63
|
-
def execute
|
64
|
-
result = GoodData.post '/gdc/xtab2/executor3', {'report_req' => {'report' => uri}}
|
65
|
-
data_result_uri = result['execResult']['dataResult']
|
66
|
-
result = GoodData.get data_result_uri
|
67
|
-
while result['taskState'] && result['taskState']['status'] == 'WAIT' do
|
68
|
-
sleep 10
|
69
|
-
result = GoodData.get data_result_uri
|
70
|
-
end
|
71
|
-
ReportDataResult.new(GoodData.get data_result_uri)
|
72
|
-
end
|
73
|
-
|
74
|
-
def exportable?
|
75
|
-
true
|
76
|
-
end
|
77
|
-
|
78
|
-
def export(format)
|
79
|
-
result = GoodData.post('/gdc/xtab2/executor3', {'report_req' => {'report' => uri}})
|
80
|
-
result1 = GoodData.post('/gdc/exporter/executor', {:result_req => {:format => format, :result => result}})
|
81
|
-
png = GoodData.get(result1['uri'], :process => false)
|
82
|
-
while (png.code == 202) do
|
83
|
-
sleep(1)
|
84
|
-
png = GoodData.get(result1['uri'], :process => false)
|
85
|
-
end
|
86
|
-
png
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"title": "x",
|
3
|
-
"datasets": [
|
4
|
-
{
|
5
|
-
"name": "payments",
|
6
|
-
"columns": [
|
7
|
-
{
|
8
|
-
"type": "attribute",
|
9
|
-
"name": "id"
|
10
|
-
},
|
11
|
-
{
|
12
|
-
"type": "fact",
|
13
|
-
"name": "amount"
|
14
|
-
},
|
15
|
-
{
|
16
|
-
"type": "reference",
|
17
|
-
"name": "user_id",
|
18
|
-
"dataset": "users",
|
19
|
-
"reference": "user_id"
|
20
|
-
}
|
21
|
-
]
|
22
|
-
},
|
23
|
-
{
|
24
|
-
"name": "users",
|
25
|
-
"columns": [
|
26
|
-
{
|
27
|
-
"type": "attribute",
|
28
|
-
"name": "user_id"
|
29
|
-
},
|
30
|
-
{
|
31
|
-
"type": "fact",
|
32
|
-
"name": "amount"
|
33
|
-
}
|
34
|
-
]
|
35
|
-
}
|
36
|
-
]
|
37
|
-
}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'gooddata/cli/cli'
|
2
|
-
|
3
|
-
describe GoodData::CLI do
|
4
|
-
it "Has working 'profile' command" do
|
5
|
-
args = %w(profile)
|
6
|
-
|
7
|
-
out = run_cli(args)
|
8
|
-
out.should include("Command 'profile' requires a subcommand show")
|
9
|
-
end
|
10
|
-
|
11
|
-
it "Has working 'profile show' command" do
|
12
|
-
args = %w(profile show)
|
13
|
-
|
14
|
-
run_cli(args)
|
15
|
-
end
|
16
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'gooddata/commands/profile'
|
2
|
-
|
3
|
-
describe GoodData::Command::Profile do
|
4
|
-
before(:each) do
|
5
|
-
ConnectionHelper::create_default_connection
|
6
|
-
end
|
7
|
-
|
8
|
-
it "Is Possible to create GoodData::Command::Profile instance" do
|
9
|
-
cmd = GoodData::Command::Profile.new()
|
10
|
-
cmd.should be_a(GoodData::Command::Profile)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "#show" do
|
14
|
-
it "Shows profile" do
|
15
|
-
GoodData::Command::Profile.show
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/spec/unit/core/core_spec.rb
DELETED
@@ -1,132 +0,0 @@
|
|
1
|
-
require 'pry'
|
2
|
-
require 'gooddata/models/model'
|
3
|
-
|
4
|
-
describe GoodData::Model::ProjectBlueprint do
|
5
|
-
|
6
|
-
before(:each) do
|
7
|
-
@valid_blueprint = GoodData::Model::ProjectBlueprint.new(
|
8
|
-
{
|
9
|
-
title: 'x',
|
10
|
-
datasets: [
|
11
|
-
{
|
12
|
-
name: 'payments',
|
13
|
-
columns: [
|
14
|
-
{
|
15
|
-
type: 'attribute',
|
16
|
-
name: 'id'
|
17
|
-
},
|
18
|
-
{
|
19
|
-
type: 'fact',
|
20
|
-
name: 'amount'
|
21
|
-
},
|
22
|
-
{
|
23
|
-
type: 'reference',
|
24
|
-
name: 'user_id',
|
25
|
-
dataset: 'users',
|
26
|
-
reference: 'user_id'
|
27
|
-
},
|
28
|
-
]
|
29
|
-
},
|
30
|
-
{
|
31
|
-
name: 'users',
|
32
|
-
columns: [
|
33
|
-
{
|
34
|
-
type: 'anchor',
|
35
|
-
name: 'user_id'
|
36
|
-
},
|
37
|
-
{
|
38
|
-
type: 'fact',
|
39
|
-
name: 'amount'
|
40
|
-
}
|
41
|
-
]
|
42
|
-
}
|
43
|
-
]})
|
44
|
-
|
45
|
-
@invalid_blueprint = GoodData::Model::ProjectBlueprint.new(
|
46
|
-
{
|
47
|
-
title: 'x',
|
48
|
-
datasets: [
|
49
|
-
{
|
50
|
-
name: 'payments',
|
51
|
-
columns: [
|
52
|
-
{
|
53
|
-
type: 'attribute',
|
54
|
-
name: 'id'
|
55
|
-
},
|
56
|
-
{
|
57
|
-
type: 'fact',
|
58
|
-
name: 'amount'
|
59
|
-
},
|
60
|
-
{
|
61
|
-
type: 'reference',
|
62
|
-
name: 'user_id',
|
63
|
-
dataset: 'users',
|
64
|
-
reference: 'user_id'
|
65
|
-
},
|
66
|
-
]
|
67
|
-
},
|
68
|
-
{
|
69
|
-
name: 'users',
|
70
|
-
columns: [
|
71
|
-
{
|
72
|
-
type: 'attribute',
|
73
|
-
name: 'user_id'
|
74
|
-
},
|
75
|
-
{
|
76
|
-
type: 'fact',
|
77
|
-
name: 'amount'
|
78
|
-
}
|
79
|
-
]
|
80
|
-
}
|
81
|
-
]})
|
82
|
-
|
83
|
-
# @valid_blueprint = blueprint = BlueprintHelper.blueprint_from_file(File.join(File.dirname(__FILE__), '../data', 'blueprint_valid.json'))
|
84
|
-
|
85
|
-
# @invalid_blueprint = BlueprintHelper.blueprint_from_file(File.join(File.dirname(__FILE__), '../data', 'blueprint_valid.json'))
|
86
|
-
end
|
87
|
-
|
88
|
-
it "valid blueprint should be marked as valid" do
|
89
|
-
@valid_blueprint.model_valid?.should == true
|
90
|
-
end
|
91
|
-
|
92
|
-
it "valid blueprint should give you empty array of errors" do
|
93
|
-
expect(@valid_blueprint.model_validate).to be_empty
|
94
|
-
end
|
95
|
-
|
96
|
-
it "invalid blueprint should be marked as invalid" do
|
97
|
-
@invalid_blueprint.model_valid?.should == false
|
98
|
-
end
|
99
|
-
|
100
|
-
it "invalid blueprint should give you list of violating references" do
|
101
|
-
errors = @invalid_blueprint.model_validate
|
102
|
-
errors.size.should == 1
|
103
|
-
errors.first.should == {
|
104
|
-
type: 'reference',
|
105
|
-
name: 'user_id',
|
106
|
-
dataset: 'users',
|
107
|
-
reference: 'user_id'
|
108
|
-
}
|
109
|
-
end
|
110
|
-
|
111
|
-
it "references return empty array if there is no reference" do
|
112
|
-
refs = @valid_blueprint.get_dataset("users").references
|
113
|
-
expect(refs).to be_empty
|
114
|
-
end
|
115
|
-
|
116
|
-
it "should be able to get dataset by name" do
|
117
|
-
ds = @valid_blueprint.get_dataset("users")
|
118
|
-
ds.name.should == "users"
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should tell you it has anchor when it does" do
|
122
|
-
ds = @valid_blueprint.get_dataset("users")
|
123
|
-
ds.has_anchor?.should == true
|
124
|
-
end
|
125
|
-
|
126
|
-
it "should tell you it does not have anchor when it does not" do
|
127
|
-
ds = @invalid_blueprint.get_dataset("users")
|
128
|
-
ds.has_anchor?.should == false
|
129
|
-
end
|
130
|
-
|
131
|
-
|
132
|
-
end
|