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

Commit

Permalink
Failing test for parsing volumetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
phss committed Aug 27, 2013
1 parent a54313f commit 8d32a31
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 2 deletions.
4 changes: 4 additions & 0 deletions backdrop/contrib/evl_upload_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,7 @@ def date_or_none(string):
else:
yield [date.isoformat(), date.date().isoformat(),
tax_disc_satisfaction, sorn_satisfaction]


def volumetrics(sheets):
pass
4 changes: 4 additions & 0 deletions backdrop/write/config/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"evl_services_failures": "excel",
"evl_channel_volumetrics": "excel",
"evl_customer_satisfaction": "excel",
"evl_volumetrics": "excel",
}
BUCKET_UPLOAD_FILTERS = {
"evl_ceg_data": [
Expand All @@ -41,6 +42,9 @@
"backdrop.core.upload.filters.first_sheet_filter",
"backdrop.contrib.evl_upload_filters.customer_satisfaction"
],
"evl_volumetrics": [
"backdrop.contrib.evl_upload_filters.volumetrics"
],
}


Expand Down
3 changes: 2 additions & 1 deletion backdrop/write/config/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
'my_bucket', 'bucket_with_auto_id', 'foo',
'my_xlsx_bucket', 'evl_ceg_data', 'evl_services_volumetrics',
'evl_services_failures', 'evl_channel_volumetrics',
'evl_customer_satisfaction', 'bucket_with_timestamp_auto_id'
'evl_customer_satisfaction', 'evl_volumetrics',
'bucket_with_timestamp_auto_id'
],
'some.other@example.com': ['foo']
}
Expand Down
1 change: 1 addition & 0 deletions features/contrib/evl_upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Feature: EVL Upload
{"_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}
"""

@wip
Scenario: Upload evl volumetrics
Given a file named "evl-volumetrics.xls" with fixture "contrib/evl-volumetrics.xls"
Expand Down
48 changes: 47 additions & 1 deletion tests/contrib/test_evl_upload_filters.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from datetime import timedelta
import unittest
from hamcrest import assert_that, is_
from backdrop.contrib.evl_upload_filters import service_volumetrics, service_failures, channel_volumetrics, customer_satisfaction
from nose.tools import nottest
from backdrop.contrib.evl_upload_filters import service_volumetrics, service_failures, channel_volumetrics, customer_satisfaction, volumetrics
from tests.support.test_helpers import d_tz


Expand Down Expand Up @@ -108,3 +109,48 @@ def test_converts_customer_satisfaction_raw_data_to_normalised_data(self):
["2013-05-01T00:00:00+00:00", "2013-05-01", 0.1, 0.2],
["2013-06-01T00:00:00+00:00", "2013-06-01", 0.3, 0.4],
["2013-07-01T00:00:00+00:00", "2013-07-01", 0.5, 0.6]]))

@nottest
def test_volumetrics_raw_data_to_normalised_data(self):
raw_data = [
["Ignore"],
["Ignore"],
["Ignore"],
["Channel Descriptions", "", "Transaction", "Apr 2012"],
["Assisted Digital", "Relicensing", "V-V10 Licence Application Post Office", 1000],
["", "", "V-V11 Licence Renewal Reminder Post Office", 1001],
["Ignore"],
["", "SORN", "V-V11 Some transaction", 1003],
["Ignore"],
["Ignore"],
["Fully Digital", "Relicensing", "V-V10 Licence Application EVL", 1006],
["", "", "V-V11 Fleets", 1007],
["", "", "V-V11 Licence Renewal Reminder EVL", 1008],
["", "", "V-V85 and V85/1 HGV Licence Application EVL", 1009],
["Ignore"],
["", "SORN", "V-V11 SORN EVL", 1011],
["", "", "V-V85/1 HGV SORN Declaration EVL", 1012],
["", "", "V-V890 SORN Declaration EVL", 1013],
["", "", "V-V890 SORN Declaration Fleets", 1014],
["Ignore"],
["Ignore"],
["Manual", "Relicensing", "V-V890 Another transaction", 1017],
["", "", "V-V11 Licence Renewal Reminder Local Office", 1018],
["", "", "V-V85 and V85/1 HGV Licence Application", 1019],
["Ignore"],
["", "SORN", "V-V11 SORN Local Office", 1021],
["", "", "V-V85/1 HGV SORN Declaration", 1022],
["", "", "V-V890 SORN Declaration", 1023],
["", "", "V-V890 SORN Declaration Key from Image", 1024],
["", "", "V-V890 SORN Declaration Refunds Input", 1025],
["", "", "V-V890 SORN Declaration Vehicles Input", 1026],
["", "", "V-V890 SORN Declaration Vehicles Triage", 1027],
["Ignore"],
["Ignore"],
["Ignore"]
]

data = list(volumetrics(raw_data))

assert_that(data, is_([["_timestamp", "service", "channel", "transaction", "volume"],
["2012-04-01T00:00:00+00:00", "tax-disc", "V-V10 Licence Application Post Office", 1000]]))

0 comments on commit 8d32a31

Please sign in to comment.