gooddata 0.6.0.pre11 → 0.6.0

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.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +12 -1
  3. data/.yardopts +2 -0
  4. data/README.md +6 -3
  5. data/Rakefile +24 -7
  6. data/gooddata +2 -2
  7. data/gooddata.gemspec +4 -3
  8. data/lib/gooddata.rb +17 -12
  9. data/lib/gooddata/bricks/base_downloader.rb +7 -7
  10. data/lib/gooddata/bricks/brick.rb +7 -8
  11. data/lib/gooddata/bricks/bricks.rb +4 -1
  12. data/lib/gooddata/bricks/middleware/base_middleware.rb +2 -2
  13. data/lib/gooddata/bricks/middleware/bench_middleware.rb +5 -6
  14. data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +21 -22
  15. data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +3 -4
  16. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +14 -14
  17. data/lib/gooddata/bricks/middleware/logger_middleware.rb +6 -6
  18. data/lib/gooddata/bricks/middleware/middleware.rb +4 -1
  19. data/lib/gooddata/bricks/middleware/restforce_middleware.rb +29 -32
  20. data/lib/gooddata/bricks/middleware/stdout_middleware.rb +5 -5
  21. data/lib/gooddata/bricks/middleware/twitter_middleware.rb +6 -8
  22. data/lib/gooddata/bricks/utils.rb +3 -3
  23. data/lib/gooddata/cli/cli.rb +4 -2
  24. data/lib/gooddata/cli/commands/api_cmd.rb +6 -4
  25. data/lib/gooddata/cli/commands/auth_cmd.rb +5 -3
  26. data/lib/gooddata/cli/commands/console_cmd.rb +1 -1
  27. data/lib/gooddata/cli/commands/process_cmd.rb +6 -4
  28. data/lib/gooddata/cli/commands/profile_cmd.rb +5 -3
  29. data/lib/gooddata/cli/commands/project_cmd.rb +24 -22
  30. data/lib/gooddata/cli/commands/run_ruby_cmd.rb +12 -10
  31. data/lib/gooddata/cli/commands/scaffold_cmd.rb +8 -6
  32. data/lib/gooddata/cli/hooks.rb +4 -2
  33. data/lib/gooddata/cli/shared.rb +3 -1
  34. data/lib/gooddata/cli/terminal.rb +16 -0
  35. data/lib/gooddata/client.rb +28 -22
  36. data/lib/gooddata/commands/api.rb +43 -26
  37. data/lib/gooddata/commands/auth.rb +22 -53
  38. data/lib/gooddata/commands/base.rb +2 -0
  39. data/lib/gooddata/commands/commands.rb +3 -0
  40. data/lib/gooddata/commands/datasets.rb +39 -136
  41. data/lib/gooddata/commands/process.rb +134 -130
  42. data/lib/gooddata/commands/profile.rb +2 -0
  43. data/lib/gooddata/commands/projects.rb +91 -129
  44. data/lib/gooddata/commands/runners.rb +11 -11
  45. data/lib/gooddata/commands/scaffold.rb +28 -26
  46. data/lib/gooddata/connection.rb +61 -68
  47. data/lib/gooddata/core/core.rb +1 -2
  48. data/lib/gooddata/data/data.rb +7 -0
  49. data/lib/gooddata/data/guesser.rb +114 -0
  50. data/lib/gooddata/exceptions/command_failed.rb +7 -0
  51. data/lib/gooddata/exceptions/exceptions.rb +7 -0
  52. data/lib/gooddata/{exceptions.rb → exceptions/project_not_found.rb} +2 -2
  53. data/lib/gooddata/extensions/big_decimal.rb +5 -0
  54. data/lib/gooddata/extract.rb +2 -0
  55. data/lib/gooddata/goodzilla/goodzilla.rb +11 -12
  56. data/lib/gooddata/helpers.rb +49 -35
  57. data/lib/gooddata/models/attribute.rb +7 -5
  58. data/lib/gooddata/models/dashboard.rb +44 -45
  59. data/lib/gooddata/models/data_result.rb +10 -13
  60. data/lib/gooddata/models/data_set.rb +6 -6
  61. data/lib/gooddata/models/display_form.rb +4 -4
  62. data/lib/gooddata/models/empty_result.rb +4 -3
  63. data/lib/gooddata/models/fact.rb +5 -5
  64. data/lib/gooddata/models/links.rb +3 -1
  65. data/lib/gooddata/models/metadata.rb +34 -32
  66. data/lib/gooddata/models/metric.rb +33 -34
  67. data/lib/gooddata/models/model.rb +165 -173
  68. data/lib/gooddata/models/models.rb +3 -0
  69. data/lib/gooddata/models/process.rb +18 -17
  70. data/lib/gooddata/models/profile.rb +3 -1
  71. data/lib/gooddata/models/project.rb +107 -35
  72. data/lib/gooddata/models/project_metadata.rb +12 -12
  73. data/lib/gooddata/models/report.rb +31 -30
  74. data/lib/gooddata/models/report_data_result.rb +22 -19
  75. data/lib/gooddata/models/report_definition.rb +101 -80
  76. data/lib/gooddata/version.rb +5 -3
  77. data/lib/templates/bricks/brick.rb.erb +3 -3
  78. data/lib/templates/bricks/main.rb.erb +3 -2
  79. data/lib/templates/project/Goodfile.erb +2 -2
  80. data/lib/templates/project/model/model.rb.erb +19 -19
  81. data/spec/data/.gooddata +4 -0
  82. data/spec/helpers/blueprint_helper.rb +2 -2
  83. data/spec/helpers/cli_helper.rb +28 -0
  84. data/spec/helpers/connection_helper.rb +2 -2
  85. data/spec/integration/command_projects_spec.rb +1 -1
  86. data/spec/integration/create_from_template_spec.rb +12 -0
  87. data/spec/integration/full_project_spec.rb +2 -2
  88. data/spec/integration/partial_md_export_import_spec.rb +36 -0
  89. data/spec/logging_in_logging_out_spec.rb +1 -1
  90. data/spec/spec_helper.rb +29 -2
  91. data/spec/unit/cli/cli_spec.rb +3 -3
  92. data/spec/unit/cli/commands/cmd_api_spec.rb +21 -4
  93. data/spec/unit/cli/commands/cmd_auth_spec.rb +2 -4
  94. data/spec/unit/cli/commands/cmd_process_spec.rb +20 -4
  95. data/spec/unit/cli/commands/cmd_profile_spec.rb +9 -4
  96. data/spec/unit/cli/commands/cmd_project_spec.rb +53 -4
  97. data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +2 -4
  98. data/spec/unit/cli/commands/cmd_scaffold_spec.rb +14 -4
  99. data/spec/unit/commands/command_api_spec.rb +21 -2
  100. data/spec/unit/commands/command_auth_spec.rb +62 -1
  101. data/spec/unit/commands/command_dataset_spec.rb +31 -3
  102. data/spec/unit/commands/command_process_spec.rb +75 -1
  103. data/spec/unit/commands/command_profile_spec.rb +7 -1
  104. data/spec/unit/commands/command_projects_spec.rb +1 -1
  105. data/spec/unit/commands/command_scaffold_spec.rb +46 -1
  106. data/spec/unit/core/connection_spec.rb +1 -0
  107. data/spec/unit/data/guesser_spec.rb +54 -0
  108. data/spec/unit/helpers_spec.rb +47 -0
  109. data/spec/unit/model/schema_builder_spec.rb +2 -0
  110. data/spec/unit/model/tools_spec.rb +89 -0
  111. data/test/test_upload.rb +39 -15
  112. metadata +98 -75
  113. data/test/test_commands.rb +0 -85
  114. data/test/test_guessing.rb +0 -46
  115. data/test/test_model.rb +0 -81
  116. data/test/test_rest_api_basic.rb +0 -41
@@ -1,12 +1,73 @@
1
+ require 'highline'
2
+
3
+ require 'gooddata/cli/terminal'
1
4
  require 'gooddata/commands/auth'
2
5
 
3
6
  describe GoodData::Command::Auth do
7
+ ORIG_TERMINAL = GoodData::CLI::DEFAULT_TERMINAL
8
+
9
+ before(:all) do
10
+ @input = StringIO.new
11
+ @output = StringIO.new
12
+ @terminal = HighLine.new(@input, @output)
13
+
14
+ GoodData::CLI::DEFAULT_TERMINAL = @terminal
15
+ end
16
+
17
+ after(:all) do
18
+ GoodData::CLI::DEFAULT_TERMINAL = ORIG_TERMINAL
19
+ end
20
+
21
+
4
22
  before(:each) do
5
- @connection = ConnectionHelper::create_default_connection
23
+ ConnectionHelper::create_default_connection
6
24
  end
7
25
 
8
26
  it "Is Possible to create GoodData::Command::Auth instance" do
9
27
  cmd = GoodData::Command::Auth.new()
10
28
  cmd.should be_a(GoodData::Command::Auth)
11
29
  end
30
+
31
+ describe "#credentials_file" do
32
+ it "Returns credentials_file" do
33
+ GoodData::Command::Auth.credentials_file
34
+ end
35
+ end
36
+
37
+ describe "#ensure_credentials" do
38
+ it "Ensures credentials existence" do
39
+ pending("Mock STDIO")
40
+ end
41
+ end
42
+
43
+ describe "#ask_for_credentials" do
44
+ credentials = {
45
+ :email => 'joedoe@example.com',
46
+ :password => 'secretPassword',
47
+ :token => 't0k3n1sk0',
48
+ }
49
+
50
+ it 'Interactively asks user for crendentials' do
51
+ pending("Mock STDIO")
52
+
53
+ @input << credentials[:email] << "\n"
54
+ @input << credentials[:password] << "\n"
55
+ @input << credentials[:token] << "\n"
56
+ @input.rewind
57
+
58
+ GoodData::Command::Auth.ask_for_credentials
59
+ end
60
+ end
61
+
62
+ describe "#store" do
63
+ it 'Stores credentials' do
64
+ pending("Mock STDIO")
65
+ end
66
+ end
67
+
68
+ describe "#unstore" do
69
+ it 'Removes stored credentials' do
70
+ pending("Mock fileutils")
71
+ end
72
+ end
12
73
  end
@@ -2,11 +2,39 @@ require 'gooddata/commands/datasets'
2
2
 
3
3
  describe GoodData::Command::Datasets do
4
4
  before(:each) do
5
- @connection = ConnectionHelper::create_default_connection
5
+ ConnectionHelper::create_default_connection
6
+ @cmd = GoodData::Command::Datasets.new()
6
7
  end
7
8
 
8
9
  it "Is Possible to create GoodData::Command::Datasets instance" do
9
- cmd = GoodData::Command::Datasets.new()
10
- cmd.should be_a(GoodData::Command::Datasets)
10
+ @cmd.should be_a(GoodData::Command::Datasets)
11
+ end
12
+
13
+ describe "#index" do
14
+ it "Lists all datasets" do
15
+ pending("GoodData::Command::Dataset#with_project not working")
16
+ @cmd.index
17
+ end
18
+ end
19
+
20
+ describe "#describe" do
21
+ it "Describes dataset" do
22
+ pending("GoodData::Command::Dataset#extract_option not working")
23
+ @cmd.describe
24
+ end
25
+ end
26
+
27
+ describe "#apply" do
28
+ it "Creates a server-side model" do
29
+ pending("GoodData::Command::Dataset#with_project not working")
30
+ @cmd.apply
31
+ end
32
+ end
33
+
34
+ describe "#load" do
35
+ it "Loads a CSV file into an existing dataset" do
36
+ pending("GoodData::Command::Dataset#with_project not working")
37
+ @cmd.load
38
+ end
11
39
  end
12
40
  end
@@ -1,12 +1,86 @@
1
1
  require 'gooddata/commands/process'
2
2
 
3
3
  describe GoodData::Command::Process do
4
+ deploy_dir = './'
5
+
4
6
  before(:each) do
5
- @connection = ConnectionHelper::create_default_connection
7
+ ConnectionHelper::create_default_connection
6
8
  end
7
9
 
8
10
  it "Is Possible to create GoodData::Command::Process instance" do
9
11
  cmd = GoodData::Command::Process.new()
10
12
  cmd.should be_a(GoodData::Command::Process)
11
13
  end
14
+
15
+ describe "#get" do
16
+ it "Should throw exception if no project specified" do
17
+ expect { GoodData::Command::Process.get }.to raise_error
18
+ end
19
+
20
+ it "Returns processes" do
21
+ pending('Project ID needed')
22
+ GoodData::Command::Process.get
23
+ end
24
+ end
25
+
26
+ describe "#deploy" do
27
+ it "Throws exception if no project specified" do
28
+ expect { GoodData::Command::Process.deploy(deploy_dir) }.to raise_error
29
+ end
30
+
31
+ it "Deploys graph" do
32
+ pending('Project ID needed')
33
+ GoodData::Command::Process.deploy(deploy_dir)
34
+ end
35
+ end
36
+
37
+ describe "#execute_process" do
38
+ it "Throws exceptions when wrong URL specified" do
39
+ link = "/gdc"
40
+ expect do
41
+ GoodData::Command::Process.execute_process(link, deploy_dir)
42
+ end.to raise_exception
43
+ end
44
+ end
45
+
46
+ describe "#list" do
47
+ it "Should throw exception if no project specified" do
48
+ expect { GoodData::Command::Process.list }.to raise_error
49
+ end
50
+
51
+ it "Returns processes" do
52
+ pending('Project ID needed')
53
+ GoodData::Command::Process.list
54
+ end
55
+ end
56
+
57
+ describe "#run" do
58
+ it "Throws exception if no project specified" do
59
+ expect { GoodData::Command::Process.run(deploy_dir) }.to raise_error
60
+ end
61
+
62
+ it "Runs process" do
63
+ pending('Project ID needed')
64
+ GoodData::Command::Process.run(deploy_dir)
65
+ end
66
+ end
67
+
68
+ describe "#with_deploy" do
69
+ it "Should throw exception if no project specified" do
70
+ expect do
71
+ GoodData::Command::Process.with_deploy(deploy_dir) do
72
+ msg = "Hello World!"
73
+ end
74
+
75
+ end.to raise_error
76
+ end
77
+
78
+ it "Executes block when deploying" do
79
+ pending('Project ID needed')
80
+ GoodData::Command::Process.with_deploy(deploy_dir) do
81
+ msg = "Hello World!"
82
+ end
83
+ end
84
+ end
85
+
12
86
  end
@@ -2,11 +2,17 @@ require 'gooddata/commands/profile'
2
2
 
3
3
  describe GoodData::Command::Profile do
4
4
  before(:each) do
5
- @connection = ConnectionHelper::create_default_connection
5
+ ConnectionHelper::create_default_connection
6
6
  end
7
7
 
8
8
  it "Is Possible to create GoodData::Command::Profile instance" do
9
9
  cmd = GoodData::Command::Profile.new()
10
10
  cmd.should be_a(GoodData::Command::Profile)
11
11
  end
12
+
13
+ describe "#show" do
14
+ it "Shows profile" do
15
+ GoodData::Command::Profile.show
16
+ end
17
+ end
12
18
  end
@@ -2,7 +2,7 @@ require 'gooddata/commands/projects'
2
2
 
3
3
  describe GoodData::Command::Projects do
4
4
  before(:each) do
5
- @connection = ConnectionHelper::create_default_connection
5
+ ConnectionHelper::create_default_connection
6
6
  end
7
7
 
8
8
  it "Is Possible to create GoodData::Command::Projects instance" do
@@ -1,12 +1,57 @@
1
1
  require 'gooddata/commands/scaffold'
2
2
 
3
3
  describe GoodData::Command::Scaffold do
4
+ before(:all) do
5
+ @suffix = Time.now.strftime('%Y%m%d%H%M%S')
6
+ end
7
+
4
8
  before(:each) do
5
- @connection = ConnectionHelper::create_default_connection
9
+ ConnectionHelper::create_default_connection
6
10
  end
7
11
 
8
12
  it "Is Possible to create GoodData::Command::Scaffold instance" do
9
13
  cmd = GoodData::Command::Scaffold.new()
10
14
  cmd.should be_a(GoodData::Command::Scaffold)
11
15
  end
16
+
17
+ describe "#brick" do
18
+ before(:each) do
19
+ @brick_name = "test_brick_#{@suffix}"
20
+ end
21
+
22
+ after(:each) do
23
+ FileUtils.rm_rf @brick_name
24
+ end
25
+
26
+ it "Throws ArgumentError exception if no name specified" do
27
+ expect do
28
+ GoodData::Command::Scaffold.brick(nil)
29
+ end.to raise_exception
30
+ end
31
+
32
+ it "Scaffolds new brick" do
33
+ GoodData::Command::Scaffold.brick(@brick_name)
34
+ end
35
+ end
36
+
37
+ describe "#project" do
38
+ before(:each) do
39
+ @project_name = "test_project_#{@suffix}"
40
+ end
41
+
42
+ after(:each) do
43
+ FileUtils.rm_rf @project_name
44
+ end
45
+
46
+ it "Throws ArgumentError exception if no name specified" do
47
+ expect do
48
+ GoodData::Command::Scaffold.project(nil)
49
+ end.to raise_exception
50
+ end
51
+
52
+ it "Scaffolds new project" do
53
+ GoodData::Command::Scaffold.project(@project_name)
54
+ end
55
+ end
56
+
12
57
  end
@@ -19,6 +19,7 @@ describe GoodData::Connection do
19
19
  end
20
20
 
21
21
  it "Connects using username and password" do
22
+ pending("This will no longer work. Discuss with Korczis")
22
23
  c = ConnectionHelper::create_default_connection(USERNAME, PASSWORD)
23
24
  c.should be_a(GoodData::Connection)
24
25
  end
@@ -0,0 +1,54 @@
1
+ require 'gooddata'
2
+
3
+ describe GoodData::Data::Guesser do
4
+ it "order LDM types as follows: cp, fact, date, attribute" do
5
+ expect = [:connection_point, :fact, :date, :attribute]
6
+ result = GoodData::Data::Guesser::sort_types([:fact, :attribute, :connection_point, :date])
7
+ result.should == expect
8
+
9
+ expect = [:fact]
10
+ result = GoodData::Data::Guesser::sort_types([:fact])
11
+ result.should == expect
12
+
13
+ expect = []
14
+ result = GoodData::Data::Guesser::sort_types([])
15
+ result.should == expect
16
+ end
17
+
18
+ it "guess facts, dates and connection points from a simple CSV" do
19
+ csv = [
20
+ ['cp', 'a1', 'a2', 'd1', 'd2', 'f'],
21
+ ['1', 'one', 'huh', '2001-01-02', nil, '-1'],
22
+ ['2', 'two', 'blah', nil, '1970-10-23', '2.3'],
23
+ ['3', 'three', 'bleh', '0000-00-00', nil, '-3.14159'],
24
+ ['4', 'one', 'huh', '2010-02-28 08:12:34', '1970-10-23', nil]
25
+ ]
26
+
27
+ fields = GoodData::Data::Guesser.new(csv).guess(csv.size + 10)
28
+
29
+ expect = GoodData::Data::Guesser::sort_types([:connection_point, :fact, :attribute])
30
+ result = fields['cp']
31
+ result.should == expect
32
+
33
+ expect = [:attribute]
34
+ result = fields['a1']
35
+ expect.should == result
36
+
37
+ expect = [:attribute]
38
+ result = fields['a2']
39
+ result.should == expect
40
+
41
+ expect = GoodData::Data::Guesser::sort_types([:attribute, :connection_point, :date])
42
+ result = fields['d1']
43
+ result.should == expect
44
+
45
+ expect = GoodData::Data::Guesser::sort_types([:attribute, :date])
46
+ result = fields['d2']
47
+ result.should == expect
48
+
49
+ expect = GoodData::Data::Guesser::sort_types([:attribute, :connection_point, :fact])
50
+ result = fields['f']
51
+ result.should == expect
52
+
53
+ end
54
+ end
@@ -0,0 +1,47 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'gooddata/client'
4
+ require 'gooddata/models/model'
5
+
6
+ describe GoodData::Helpers do
7
+ describe '#home_directory' do
8
+ it 'works' do
9
+ GoodData::Helpers.home_directory
10
+ end
11
+ end
12
+
13
+ describe '#running_on_windows?' do
14
+ it 'works' do
15
+ result = GoodData::Helpers.running_on_windows?
16
+ !!result.should == result
17
+ end
18
+ end
19
+
20
+ describe '#running_on_mac?' do
21
+ it 'works' do
22
+ result = GoodData::Helpers.running_on_a_mac?
23
+ !!result.should == result
24
+ end
25
+ end
26
+
27
+ describe '#error' do
28
+ it 'works' do
29
+ expect { GoodData::Helpers.error('Test Error') }.to raise_error(SystemExit)
30
+ end
31
+ end
32
+
33
+ describe '#find_goodfile' do
34
+ it 'works' do
35
+ pending "Ask @fluke777 how to create one"
36
+ GoodData::Helpers.find_goodfile.should_not be_nil
37
+ end
38
+ end
39
+
40
+ describe '#sanitize_string' do
41
+ it 'works' do
42
+ expect = 'helloworld'
43
+ result = GoodData::Helpers.sanitize_string('Hello World')
44
+ result.should == expect
45
+ end
46
+ end
47
+ end
@@ -4,6 +4,8 @@ require 'gooddata/models/model'
4
4
  describe GoodData::Model::SchemaBuilder do
5
5
 
6
6
  it "should create a schema" do
7
+ # pending("Using of humanize")
8
+
7
9
  builder = GoodData::Model::SchemaBuilder.new("a_title")
8
10
  schema = builder.to_schema
9
11
  schema.title.should == "A title"
@@ -0,0 +1,89 @@
1
+ # encoding: UTF-8
2
+
3
+ require 'gooddata/client'
4
+ require 'gooddata/models/model'
5
+
6
+ describe GoodData::Model do
7
+ COLUMNS = [
8
+ {:type =>:anchor, :name =>'cp', 'title' => 'CP', 'folder' => 'test'},
9
+ {:type =>:attribute, :name =>'a1', 'title' => 'A1', 'folder' => 'test'},
10
+ {:type =>:attribute, :name =>'a2', 'title' => 'A2', 'folder' => 'test'},
11
+ {:type =>:date, :name =>'event', 'title' => 'Event', 'folder' => 'test'},
12
+ {:type =>:fact, :name =>'f1', 'title' => 'F1', 'folder' => 'test'},
13
+ {:type =>:fact, :name =>'f2', 'title' => 'F2', 'folder' => 'test'},
14
+ ]
15
+ SCHEMA = GoodData::Model::Schema.new :name => 'test', :title => 'test', :columns => COLUMNS
16
+
17
+ before(:all) do
18
+ GoodData::connect
19
+ end
20
+
21
+ it 'generate identifiers starting with letters and without ugly characters' do
22
+ pending "We need o figure out what is the right way to do it"
23
+ expect = 'fact.test.blah'
24
+ result = GoodData::Model::Fact.new({:name =>'blah'}, SCHEMA).identifier
25
+ result.should == expect
26
+
27
+ expect = 'attr.test.blah'
28
+ result = GoodData::Model::Attribute.new({:name =>'1_2_3 blah'}, SCHEMA).identifier
29
+ result.should == expect
30
+
31
+ expect = 'dim.blaz'
32
+ result = GoodData::Model::AttributeFolder.new(' b*ĺ*á#ž$').identifier
33
+ result.should == expect
34
+ end
35
+
36
+ it "create a simple model in a sandbox project using project.model.add_dataset" do
37
+ pending "Throws 400 - Bad request now"
38
+
39
+ project = GoodData::Project.create :title => "gooddata-ruby test #{Time.new.to_i}"
40
+ objects = project.add_dataset 'Mrkev', COLUMNS
41
+
42
+ uris = objects['uris']
43
+ uris[0].should == "#{project.md['obj']}/1"
44
+ # fetch last object (temporary objects can be placed at the begining of the list)
45
+ GoodData.get uris[uris.length - 1]
46
+ project.delete
47
+ end
48
+
49
+ it "create a simple model in a sandbox project using Model.add_dataset" do
50
+ pending "Throws 400 - Bad request now"
51
+
52
+ project = GoodData::Project.create :title => "gooddata-ruby test #{Time.new.to_i}"
53
+ GoodData.use project
54
+ objects = GoodData::Model.add_dataset 'Mrkev', COLUMNS
55
+
56
+ uris = objects['uris']
57
+ uris[0].should == "#{project.md['obj']}/1"
58
+
59
+ # fetch last object (temporary objects can be placed at the begining of the list)
60
+ GoodData.get uris[uris.length - 1]
61
+
62
+ # created model should define SLI interface on the 'Mrkev' data set
63
+ # TODO move this into a standalone test covering gooddata/metadata.rb
64
+ ds = GoodData::DataSet['dataset.mrkev']
65
+ ds.should_not be_nil
66
+
67
+ project.delete
68
+ end
69
+
70
+ it "create a simple model with no CP in a sandbox project using Model.add_dataset" do
71
+ pending "Throws 400 - Bad request now"
72
+
73
+ project = GoodData::Project.create :title => "gooddata-ruby test #{Time.new.to_i}"
74
+ GoodData.use project
75
+
76
+ # create a similar data set but without the connection point column
77
+ cols_no_cp = COLUMNS.select { |c| c['type'] != 'CONNECTION_POINT' }
78
+ objects = GoodData::Model.add_dataset 'No CP', cols_no_cp
79
+ uris = objects['uris']
80
+
81
+ # Repeat check of metadata objects expected to be created on the server side
82
+ GoodData.get uris[uris.length - 1]
83
+ ds = GoodData::DataSet['dataset.nocp']
84
+ ds.should_not be_nil
85
+
86
+ # clean-up
87
+ project.delete
88
+ end
89
+ end