-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support from-date parameter in csv export
- Loading branch information
Martin Fenner
committed
Mar 9, 2020
1 parent
c9bcb0b
commit 6d1c13e
Showing
6 changed files
with
49 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,17 @@ | |
expect(csv[1]).to start_with("Virtual Library of Virginia,VIVA,,true") | ||
expect(csv[2]).to start_with("University of Virginia,UVA,VIVA,true") | ||
end | ||
|
||
it 'returns organizations from date', vcr: false do | ||
get "/export/organizations?from-date=#{Date.today}", nil, admin_headers | ||
|
||
expect(last_response.status).to eq(200) | ||
csv = last_response.body.lines | ||
expect(csv.length).to eq(3) | ||
expect(csv[0]).to start_with("Name,fabricaAccountId,Parent Organization,Is Active") | ||
expect(csv[1]).to start_with("Virtual Library of Virginia,VIVA,,true") | ||
expect(csv[2]).to start_with("University of Virginia,UVA,VIVA,true") | ||
end | ||
end | ||
|
||
describe "GET /export/repositories", elasticsearch: true do | ||
|
@@ -46,6 +57,18 @@ | |
dois_total = csv[1].strip.split(",").last.to_i | ||
expect(dois_total).to eq(3) | ||
end | ||
|
||
it 'returns repositories from date', vcr: false do | ||
get "/export/repositories?from-date=#{Date.today}", nil, admin_headers | ||
|
||
expect(last_response.status).to eq(200) | ||
csv = last_response.body.lines | ||
expect(csv.length).to eq(2) | ||
expect(csv[0]).to start_with("Repository Name,Repository ID,Organization,isActive") | ||
expect(csv[1]).to start_with("University of Virginia Library,UVA.LIBRARY,UVA,true") | ||
dois_total = csv[1].strip.split(",").last.to_i | ||
expect(dois_total).to eq(3) | ||
end | ||
end | ||
|
||
describe "GET /export/contacts", elasticsearch: true do | ||
|
@@ -67,6 +90,19 @@ | |
expect(csv[4]).to start_with("VIVA,[email protected],[email protected],Trisha,Cruse,billing;secondaryBilling") | ||
end | ||
|
||
it 'returns all contacts from date', vcr: false do | ||
get "/export/contacts?from-date=#{Date.today}", nil, admin_headers | ||
|
||
expect(last_response.status).to eq(200) | ||
csv = last_response.body.lines | ||
expect(csv.length).to eq(5) | ||
expect(csv[0]).to eq("fabricaAccountId,fabricaId,email,firstName,lastName,type\n") | ||
expect(csv[1]).to start_with("VIVA,[email protected],[email protected],Kristian,Garza,technical;secondaryTechnical") | ||
expect(csv[2]).to start_with("VIVA,[email protected],[email protected],Martin,Fenner,service;secondaryService") | ||
expect(csv[3]).to start_with("VIVA,[email protected],[email protected],Robin,Dasler,voting") | ||
expect(csv[4]).to start_with("VIVA,[email protected],[email protected],Trisha,Cruse,billing;secondaryBilling") | ||
end | ||
|
||
it 'returns voting contacts', vcr: false do | ||
get "/export/contacts?type=voting", nil, admin_headers | ||
|
||
|