gooddata 0.6.43 → 0.6.44

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.
@@ -49,7 +49,7 @@ describe 'Create project using GoodData client', :constraint => 'slow' do
49
49
  reference: 'attr.commits.factsof',
50
50
  name: 'anchor_label')
51
51
  end
52
- @project.update_from_blueprint(bp, preference: { cascade_drops: false, preserve_data: false})
52
+ @project.update_from_blueprint(bp, maql_replacements: { "PRESERVE DATA" => ""})
53
53
  data = [
54
54
  ['label.commits.factsof.id', 'fact.commits.lines_changed', 'committed_on', 'dataset.devs', 'dataset.repos'],
55
55
  ['111', 1, '01/01/2011', '1', '1'],
@@ -31,7 +31,7 @@ describe "Full project implementation", :constraint => 'slow' do
31
31
 
32
32
  it "should do nothing if the project is updated with the same blueprint" do
33
33
  results = GoodData::Model::ProjectCreator.migrate_datasets(@spec, project: @project, client: @client, dry_run: true)
34
- expect(results).to be_nil
34
+ expect(results).to eq []
35
35
  end
36
36
 
37
37
  it 'should try to rename a dataset back' do
@@ -40,20 +40,19 @@ describe "Full project implementation", :constraint => 'slow' do
40
40
  dataset.save
41
41
 
42
42
  # Now the update of project using the original blueprint should offer update of the title. Nothing else.
43
- results = GoodData::Model::ProjectCreator.migrate_datasets(@blueprint, project: @project, client: @client, dry_run: true)
44
43
  results = GoodData::Model::ProjectCreator.migrate_datasets(@spec, project: @project, client: @client, dry_run: true)
45
- expect(results['updateScript']['maqlDdl']).to eq "ALTER DATASET {dataset.repos} VISUAL(TITLE \"Repositories\", DESCRIPTION \"\");\n"
44
+ expect(results.first['updateScript']['maqlDdlChunks']).to eq ["ALTER DATASET {dataset.repos} VISUAL(TITLE \"Repositories\", DESCRIPTION \"\");\n"]
46
45
 
47
46
  # Update using a freshly gained blueprint should offer no changes.
48
47
  new_blueprint = @project.blueprint
49
48
  results = GoodData::Model::ProjectCreator.migrate_datasets(new_blueprint, project: @project, client: @client, dry_run: true)
50
- expect(results).to be_nil
49
+ expect(results).to eq []
51
50
 
52
51
  # When we change the model using the original blueprint. Basically change the title back.
53
52
  results = @project.update_from_blueprint(@spec)
54
53
  # It should offer no changes using the original blueprint
55
54
  results = GoodData::Model::ProjectCreator.migrate_datasets(@spec, project: @project, client: @client, dry_run: true)
56
- expect(results).to be_nil
55
+ expect(results).to eq []
57
56
  end
58
57
 
59
58
  it "should contain datasets" do
@@ -470,12 +469,16 @@ describe "Full project implementation", :constraint => 'slow' do
470
469
 
471
470
  it "should be able to give you values for" do
472
471
  attribute = @project.attributes('attr.devs.dev_id')
473
- expect(attribute.values_for(2)).to eq ["tomas@gooddata.com", "1"]
472
+ values = attribute.labels.find { |l| l.identifier == 'label.devs.dev_id.email'}.values.to_a
473
+ id = values.find { |v| v[:value] == 'tomas@gooddata.com' }[:uri][-1].to_i
474
+ expect(attribute.values_for(id)).to eq ['tomas@gooddata.com', '1']
474
475
  end
475
476
 
476
477
  it "should be able to find specific element and give you the primary label value" do
477
478
  attribute = @project.attributes('attr.devs.dev_id')
478
- expect(@project.find_attribute_element_value("#{attribute.uri}/elements?id=2")).to eq 'tomas@gooddata.com'
479
+ values = attribute.labels.find { |l| l.identifier == 'label.devs.dev_id.email'}.values.to_a
480
+ uri = values.find { |v| v[:value] == 'tomas@gooddata.com' }[:uri]
481
+ expect(@project.find_attribute_element_value(uri)).to eq 'tomas@gooddata.com'
479
482
  end
480
483
 
481
484
  it "should be able to give you label by name" do
@@ -13,9 +13,7 @@ describe GoodData::Schedule do
13
13
 
14
14
  before(:all) do
15
15
  @client = ConnectionHelper.create_default_connection
16
-
17
16
  @project = ProjectHelper.get_default_project(:client => @client)
18
-
19
17
  # ScheduleHelper.remove_old_schedules(@project)
20
18
  # ProcessHelper.remove_old_processes(@project)
21
19
  end
@@ -86,8 +86,8 @@ describe GoodData::Rest::Connection, :constraint => 'slow' do
86
86
  it "should be able to regenerate TT" do
87
87
  regular_client = ConnectionHelper::create_default_connection
88
88
  projects = regular_client.projects
89
- regular_client.connection.cookies[:cookies].delete('GDCAuthTT')
89
+ regular_client.connection.headers.delete(:x_gdc_authtt)
90
90
  regular_client.get('/gdc/md')
91
- expect(regular_client.connection.cookies[:cookies]).to have_key 'GDCAuthTT'
91
+ expect(regular_client.connection.headers).to have_key :x_gdc_authtt
92
92
  end
93
93
  end
@@ -8,7 +8,7 @@ require 'gooddata/models/project_creator'
8
8
 
9
9
  describe GoodData::Model::ProjectCreator do
10
10
 
11
- it 'should pick correct update chunk based on priority' do
11
+ before(:each) do
12
12
  # Priority is
13
13
  #
14
14
  # [cascadeDrops, preserveData],
@@ -16,112 +16,60 @@ describe GoodData::Model::ProjectCreator do
16
16
  # [false, false],
17
17
  # [true, true],
18
18
  # [true, false]
19
- data = [
20
- { 'updateScript' => {
21
- 'cascadeDrops' => false,
22
- 'preserveData' => true,
23
- 'maqlDdlChunks' => "a"
24
- }},
25
- { 'updateScript' => {
26
- 'cascadeDrops' => false,
27
- 'preserveData' => false,
28
- 'maqlDdlChunks' => "b"
29
- }}
30
- ]
31
- chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(data)
32
- chunk.should == {
33
- 'updateScript' => {
34
- 'cascadeDrops' => false,
35
- 'preserveData' => true,
36
- 'maqlDdlChunks' => "a"
37
- }}
19
+ #
20
+ # The data is ordered in descending priority
21
+ @chunk_a = {
22
+ 'updateScript' => {
23
+ 'cascadeDrops' => false,
24
+ 'preserveData' => true,
25
+ 'maqlDdlChunks' => 'a'
26
+ }
27
+ }
38
28
 
29
+ @chunk_b = {
30
+ 'updateScript' => {
31
+ 'cascadeDrops' => false,
32
+ 'preserveData' => false,
33
+ 'maqlDdlChunks' => 'b'
34
+ }
35
+ }
36
+ @chunk_c = {
37
+ 'updateScript' => {
38
+ 'cascadeDrops' => true,
39
+ 'preserveData' => true,
40
+ 'maqlDdlChunks' => 'c'
41
+ }
42
+ }
39
43
 
40
- data = [
41
- { 'updateScript' => {
42
- 'cascadeDrops' => true,
43
- 'preserveData' => true,
44
- 'maqlDdlChunks' => "a"
45
- }},
46
- { 'updateScript' => {
47
- 'cascadeDrops' => true,
48
- 'preserveData' => false,
49
- 'maqlDdlChunks' => "b"
50
- }}
51
- ]
52
- chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(data)
53
- chunk.should == {
54
- 'updateScript' => {
55
- 'cascadeDrops' => true,
56
- 'preserveData' => true,
57
- 'maqlDdlChunks' => "a"
58
- }}
44
+ @chunk_d = {
45
+ 'updateScript' => {
46
+ 'cascadeDrops' => true,
47
+ 'preserveData' => false,
48
+ 'maqlDdlChunks' => 'd'
49
+ }
50
+ }
59
51
 
52
+ @data = [@chunk_a, @chunk_b, @chunk_c, @chunk_d]
60
53
 
61
- data = [
62
- { 'updateScript' => {
63
- 'cascadeDrops' => true,
64
- 'preserveData' => false,
65
- 'maqlDdlChunks' => "a"
66
- }},
67
- { 'updateScript' => {
68
- 'cascadeDrops' => true,
69
- 'preserveData' => true,
70
- 'maqlDdlChunks' => "b"
71
- }}
72
- ]
73
- chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(data)
74
- chunk.should == {
75
- 'updateScript' => {
76
- 'cascadeDrops' => true,
77
- 'preserveData' => true,
78
- 'maqlDdlChunks' => "b"
79
- }}
80
54
  end
81
55
 
82
- it 'should pick correct update chunk based on your preference if it is possible to satisfy it' do
83
- data = [
84
- { 'updateScript' => {
85
- 'cascadeDrops' => true,
86
- 'preserveData' => false,
87
- 'maqlDdlChunks' => "a"
88
- }},
89
- { 'updateScript' => {
90
- 'cascadeDrops' => true,
91
- 'preserveData' => true,
92
- 'maqlDdlChunks' => "b"
93
- }}
94
- ]
56
+ it 'should pick correct update chunk based on priority' do
57
+ chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data)
58
+ expect(chunk).to eq [@chunk_a]
59
+ end
95
60
 
96
- chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(data, preference: { cascade_drops: true, preserve_data: false})
97
- chunk.should == {
98
- 'updateScript' => {
99
- 'cascadeDrops' => true,
100
- 'preserveData' => false,
101
- 'maqlDdlChunks' => "a"
102
- }}
61
+ it 'should pick correct update chunk based on your preference if it is possible to satisfy it' do
62
+ chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true, preserve_data: false})
63
+ expect(chunk).to eq [@chunk_d]
103
64
  end
104
65
 
105
- it 'should pick correct update chunk based on your preference if it is not possible to satisfy it' do
106
- data = [
107
- { 'updateScript' => {
108
- 'cascadeDrops' => true,
109
- 'preserveData' => true,
110
- 'maqlDdlChunks' => "a"
111
- }},
112
- { 'updateScript' => {
113
- 'cascadeDrops' => false,
114
- 'preserveData' => true,
115
- 'maqlDdlChunks' => "b"
116
- }}
117
- ]
66
+ it 'should pick correct update chunks based on your preference if it is possible to satisfy it and the preference is ambiguous' do
67
+ chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true })
68
+ expect(chunk).to eq [@chunk_c, @chunk_d]
69
+ end
118
70
 
119
- chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(data, preference: { cascade_drops: true, preserve_data: false})
120
- chunk.should == {
121
- 'updateScript' => {
122
- 'cascadeDrops' => false,
123
- 'preserveData' => true,
124
- 'maqlDdlChunks' => "b"
125
- }}
71
+ it 'should not pick a chunk if it is not possible to satisfy it based on your preference' do
72
+ chunk = GoodData::Model::ProjectCreator.pick_correct_chunks(@data, update_preference: { cascade_drops: true, preserve_data: false, unmeetable_condition: true})
73
+ expect(chunk).to eq []
126
74
  end
127
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gooddata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.43
4
+ version: 0.6.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kolesnikov
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-10-06 00:00:00.000000000 Z
14
+ date: 2016-10-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -685,6 +685,7 @@ files:
685
685
  - lib/gooddata/exceptions/execution_limit_exceeded.rb
686
686
  - lib/gooddata/exceptions/filter_maqlization.rb
687
687
  - lib/gooddata/exceptions/malformed_user.rb
688
+ - lib/gooddata/exceptions/maql_execution.rb
688
689
  - lib/gooddata/exceptions/no_project_error.rb
689
690
  - lib/gooddata/exceptions/object_migration.rb
690
691
  - lib/gooddata/exceptions/project_not_found.rb