Adapt tests

pull/14991/head
Javier Goizueta 5 years ago
parent cbbf084cba
commit 9f2814b437

@ -0,0 +1,11 @@
Country,Amount,carto_geocode_hash
Spain,1,x
France,2,x
China,3,x
Japan,4,x
UK,5,x
Holland,8,x
Korea,6,x
The Netherlands,7,x
Portugal,9,x
Brazil,10,x
1 Country Amount carto_geocode_hash
2 Spain 1 x
3 France 2 x
4 China 3 x
5 Japan 4 x
6 UK 5 x
7 Holland 8 x
8 Korea 6 x
9 The Netherlands 7 x
10 Portugal 9 x
11 Brazil 10 x

@ -149,7 +149,7 @@ describe Synchronization::Member do
@user1.reload
end
it 'now works with tables with views' do
it 'fails to overwrite tables with views by replacement' do
url = 'https://wadus.com/guess_country.csv'
path = fake_data_path('guess_country.csv')
@ -169,6 +169,31 @@ describe Synchronization::Member do
@user2.in_database.execute('CREATE VIEW wadus AS SELECT * FROM guess_country')
member.run
expect(member.state).to eq 'failure'
expect(member.error_code).to eq 2013
end
it 'it can overwrite tables with views by sync' do
url = 'https://wadus.com/guess_country_geocoded.csv'
path = fake_data_path('guess_country_geocoded.csv')
stub_download(url: url, filepath: path, content_disposition: false)
attrs = random_attributes(user_id: @user2.id).merge(service_item_id: url, url: url, name: 'guess_country_geocoded')
member = Synchronization::Member.new(attrs).store
DataImport.create(
user_id: @user2.id,
data_source: path,
synchronization_id: member.id,
service_name: 'public_url',
service_item_id: url,
updated_at: Time.now
).run_import!
@user2.in_database.execute('CREATE VIEW wadus_geocoded AS SELECT * FROM guess_country_geocoded')
member.run
expect(member.state).to eq 'success'
end

Loading…
Cancel
Save