-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathdeprecated_load_spec.rb
60 lines (53 loc) · 2.22 KB
/
deprecated_load_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
require 'gooddata'
describe "Full project implementation", :vcr, :vcr_all_cassette => 'deprecated', :constraint => 'slow' do
before(:all) do
@client = ConnectionHelper.create_default_connection
@blueprint = GoodData::Model::ProjectBlueprint.build("my_bp") do |p|
p.add_dataset("dataset.repos") do |d|
d.add_anchor("attr.repository")
d.add_label('label.repository.name', reference: 'attr.repository')
d.add_attribute("attr.attribute1", title: 'Some attribute')
d.add_label('label.attribute1.name', reference: 'attr.attribute1')
d.add_fact('some_numbers', gd_data_type: 'INT')
end
end
@project = @client.create_project_from_blueprint(@blueprint, token: ConnectionHelper::SECRETS[:gd_project_token], environment: ProjectHelper::ENVIRONMENT)
end
after(:all) do
@project.delete unless @project.nil?
@client.disconnect
end
it 'should upload data using local blueprint' do
devs_data = [
["label.repository.name", "label.attribute1.name", "some_numbers"],
[1, "[email protected]", 10],
[2, "[email protected]", 20],
[3, "[email protected]", 30]
]
@project.upload(devs_data, @blueprint, 'dataset.repos')
vals = @project.labels('label.repository.name').values.to_a.map { |label| label[:value] }
expect(vals).to eq %w(1 2 3)
end
it 'should upload the data when you deprecate attribute with remote blueprint' do
l = @project.labels('label.repository.name')
l.deprecated = true
l.save
b = @project.labels(l.identifier)
expect(b.deprecated?).to be_truthy
devs_data = [
["label.repository.name", "label.attribute1.name", "some_numbers"],
[1, "[email protected]", 10],
[2, "[email protected]", 20],
[3, "[email protected]", 30],
[4, "[email protected]", 40]
]
@project.upload(devs_data, @project.blueprint, 'dataset.repos')
vals = @project.labels('label.repository.name').values.to_a.map { |label| label[:value] }
expect(vals).to eq %w(1 2 3 4)
end
end