Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Move tests from feature tests to unit tests
Browse files Browse the repository at this point in the history
The steps used by our feature tests would have needed to post to Backdrop (which isn't running).

We could have mocked out Backdrop in the feature tests but we already do this in our unit tests, and this is the right place to test this functionality anyway.
  • Loading branch information
nick-gravgaard committed Jul 8, 2014
1 parent 4b3b01e commit c05bde9
Show file tree
Hide file tree
Showing 3 changed files with 228 additions and 140 deletions.
43 changes: 0 additions & 43 deletions features/admin/csv_upload.feature
Original file line number Diff line number Diff line change
@@ -1,49 +1,6 @@
@use_admin_client
Feature: CSV Upload

@bob
Scenario: Upload CSV data
Given I have a data_set named "my_data_set" with settings
| key | value |
| upload_format | "csv" |
And I am logged in
And I can upload to "my_data_set"
And a file named "data.csv"
"""
name,age,nationality
Pawel,27,Polish
Max,35,Italian
"""
When I go to "/my_data_set/upload"
And I enter "data.csv" into the file upload field
And I click "Upload"
Then the "my_data_set" data_set should contain in any order:
"""
{"name": "Pawel", "age": 27, "nationality": "Polish"}
{"name": "Max", "age": 35, "nationality": "Italian"}
"""

Scenario: UTF8 characters
Given a file named "data.csv":
"""
english,italian
city,città
coffee,caffè
"""
And I have a data_set named "my_data_set" with settings
| key | value |
| upload_format | "csv" |
And I am logged in
And I can upload to "my_data_set"
When I go to "/my_data_set/upload"
And I enter "data.csv" into the file upload field
And I click "Upload"
Then the "my_data_set" data_set should contain in any order:
"""
{"english": "city", "italian": "città"}
{"english": "coffee", "italian": "caffè"}
"""

# If the uploaded CSV does not have an _id column,
# overwrite records with the same combination of:
# start_at, end_at and key
Expand Down
89 changes: 0 additions & 89 deletions features/contrib/evl_upload.feature
Original file line number Diff line number Diff line change
@@ -1,95 +1,6 @@
@use_admin_client
Feature: EVL Upload

Scenario: Upload call center volumes
Given a file named "CEG Data.xlsx" with fixture "contrib/CEG Transaction Tracker.xlsx"
and I have a data_set named "evl_ceg_data" with settings
| key | value |
| upload_format | "excel" |
| upload_filters | ["backdrop.core.upload.filters.first_sheet_filter","backdrop.contrib.evl_upload_filters.ceg_volumes"] |
and I am logged in
and I can upload to "evl_ceg_data"
when I go to "/evl_ceg_data/upload"
and I enter "CEG Data.xlsx" into the file upload field
and I click "Upload"
then the platform should have "71" items stored in "evl_ceg_data"
and the "evl_ceg_data" data_set should have items:
"""
{"_timestamp": "2008-09-01T00:00:00+00:00", "_id": "2008-09-01", "timeSpan":"month", "relicensing_web": 100, "relicensing_ivr": 200, "relicensing_agent": 700, "sorn_web": 1100, "sorn_ivr": 1200, "sorn_agent": 1300, "agent_automated_dupes": 1400, "calls_answered_by_advisor": 1500}
"""

Scenario: Upload services volumetrics
Given a file named "EVL Volumetrics.xlsx" with fixture "contrib/EVL Services Volumetrics Sample.xls"
and I have a data_set named "evl_services_volumetrics" with settings
| key | value |
| upload_format | "excel" |
| upload_filters | ["backdrop.core.upload.filters.first_sheet_filter","backdrop.contrib.evl_upload_filters.service_volumetrics"] |
and I am logged in
and I can upload to "evl_services_volumetrics"
when I go to "/evl_services_volumetrics/upload"
and I enter "EVL Volumetrics.xlsx" into the file upload field
and I click "Upload"
then the platform should have "1" items stored in "evl_services_volumetrics"
and the "evl_services_volumetrics" data_set should have items:
"""
{"_timestamp": "2013-08-01T00:00:00+00:00", "_id": "2013-08-01", "timeSpan":"day", "successful_tax_disc": 100.0, "successful_sorn": 200.0}
"""

Scenario: Upload service failures
Given a file named "EVL Volumetrics.xlsx" with fixture "contrib/EVL Services Volumetrics Sample.xls"
and I have a data_set named "evl_services_failures" with settings
| key | value |
| upload_format | "excel" |
| upload_filters | ["backdrop.contrib.evl_upload_filters.service_failures"] |
and I am logged in
and I can upload to "evl_services_failures"
when I go to "/evl_services_failures/upload"
and I enter "EVL Volumetrics.xlsx" into the file upload field
and I click "Upload"
then the platform should have "136" items stored in "evl_services_failures"
and the "evl_services_failures" data_set should have items:
"""
{"_timestamp": "2013-08-01T00:00:00+00:00", "_id": "2013-08-01.tax-disc.0", "type": "tax-disc", "reason": 0, "count": 1, "description": "Abandoned"}
{"_timestamp": "2013-08-01T00:00:00+00:00", "_id": "2013-08-01.tax-disc.66", "type": "tax-disc", "reason": 66, "count": 67, "description": "LPB Response Code was PSP Session Timeout"}
{"_timestamp": "2013-08-01T00:00:00+00:00", "_id": "2013-08-01.sorn.5", "type": "sorn", "reason": 5, "count": 8, "description": "User Cancelled Transaction"}
"""

Scenario: Upload channel volumetrics
Given a file named "EVL Volumetrics.xlsx" with fixture "contrib/EVL Channel Volumetrics Sample.xls"
and I have a data_set named "evl_channel_volumetrics" with settings
| key | value |
| upload_format | "excel" |
| upload_filters | ["backdrop.core.upload.filters.first_sheet_filter","backdrop.contrib.evl_upload_filters.channel_volumetrics"] |
and I am logged in
and I can upload to "evl_channel_volumetrics"
when I go to "/evl_channel_volumetrics/upload"
and I enter "EVL Volumetrics.xlsx" into the file upload field
and I click "Upload"
then the platform should have "2" items stored in "evl_channel_volumetrics"
and the "evl_channel_volumetrics" data_set should have items:
"""
{"_timestamp": "2013-07-29T00:00:00+00:00", "_id": "2013-07-29", "successful_agent": 100.0, "successful_ivr": 101.0, "successful_web": 102.0, "total_agent": 200.0, "total_ivr": 201.0, "total_web": 202.0}
{"_timestamp": "2013-07-30T00:00:00+00:00", "_id": "2013-07-30", "successful_agent": 101.0, "successful_ivr": 102.0, "successful_web": 103.0, "total_agent": 201.0, "total_ivr": 202.0, "total_web": 203.0}
"""

Scenario: Upload customer satisfaction
Given a file named "EVL Satisfaction.xlsx" with fixture "contrib/EVL Customer Satisfaction.xlsx"
and I have a data_set named "evl_customer_satisfaction" with settings
| key | value |
| upload_format | "excel" |
| upload_filters | ["backdrop.core.upload.filters.first_sheet_filter","backdrop.contrib.evl_upload_filters.customer_satisfaction"] |
and I am logged in
and I can upload to "evl_customer_satisfaction"
when I go to "/evl_customer_satisfaction/upload"
and I enter "EVL Satisfaction.xlsx" into the file upload field
and I click "Upload"
then the platform should have "113" items stored in "evl_customer_satisfaction"
and the "evl_customer_satisfaction" data_set should have items:
"""
{"_timestamp": "2013-08-01T00:00:00+00:00", "_id": "2013-08-01", "satisfaction_tax_disc": 1.2487024060928635, "satisfaction_sorn": 1.4370298628996634}
{"_timestamp": "2007-07-01T00:00:00+00:00", "_id": "2007-07-01", "satisfaction_tax_disc": 1.1662755514934828, "satisfaction_sorn": 1.3581011781786714}
"""

Scenario: Upload evl volumetrics
Given a file named "evl-volumetrics.xls" with fixture "contrib/evl-volumetrics.xls"
and I have a data_set named "evl_volumetrics" with settings
Expand Down
Loading

0 comments on commit c05bde9

Please sign in to comment.