- Timestamp:
- 28 Nov 2014, 06:56:38 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/export.py
r12056 r12076 114 114 115 115 116 class Customer sExporter(grok.GlobalUtility, CustomerExporterBase):116 class CustomerExporter(grok.GlobalUtility, CustomerExporterBase): 117 117 """Exporter for Customers. 118 118 """ … … 134 134 value = str('%s#' % value) 135 135 return super( 136 Customer sExporter, self).mangle_value(136 CustomerExporter, self).mangle_value( 137 137 value, name, context=context) 138 138 139 class CustomerDocument sExporter(grok.GlobalUtility, CustomerExporterBase):139 class CustomerDocumentExporter(grok.GlobalUtility, CustomerExporterBase): 140 140 """Exporter for CustomerDocument instances. 141 141 """ … … 169 169 value = getattr(customer, name, None) 170 170 return super( 171 CustomerDocument sExporter, self).mangle_value(171 CustomerDocumentExporter, self).mangle_value( 172 172 value, name, context=context) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py
r12057 r12076 1 ## $Id$ 2 ## 3 ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann 4 ## This program is free software; you can redistribute it and/or modify 5 ## it under the terms of the GNU General Public License as published by 6 ## the Free Software Foundation; either version 2 of the License, or 7 ## (at your option) any later version. 8 ## 9 ## This program is distributed in the hope that it will be useful, 10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of 11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 ## GNU General Public License for more details. 13 ## 14 ## You should have received a copy of the GNU General Public License 15 ## along with this program; if not, write to the Free Software 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 ## 18 """ 19 Test the customer exporter. 20 """ 21 1 22 import os 2 23 import grok … … 10 31 from waeup.ikoba.customers.catalog import CustomersQuery 11 32 from waeup.ikoba.customers.export import ( 12 Customer sExporter, CustomerDocumentsExporter, get_customers)33 CustomerExporter, CustomerDocumentExporter, get_customers) 13 34 from waeup.ikoba.customers.interfaces import ICSVCustomerExporter 14 35 from waeup.ikoba.customers.customer import Customer … … 38 59 return 39 60 40 class Customer sExporterTest(CustomerImportExportSetup):61 class CustomerExporterTest(CustomerImportExportSetup): 41 62 42 63 layer = FunctionalLayer 43 64 44 65 def setUp(self): 45 super(Customer sExporterTest, self).setUp()66 super(CustomerExporterTest, self).setUp() 46 67 self.setup_for_export() 47 68 return … … 49 70 def test_ifaces(self): 50 71 # make sure we fullfill interface contracts 51 obj = Customer sExporter()72 obj = CustomerExporter() 52 73 verifyObject(ICSVCustomerExporter, obj) 53 verifyClass(ICSVCustomerExporter, Customer sExporter)74 verifyClass(ICSVCustomerExporter, CustomerExporter) 54 75 return 55 76 … … 64 85 # set values we can expect in export file 65 86 self.setup_customer(self.customer) 66 exporter = Customer sExporter()87 exporter = CustomerExporter() 67 88 exporter.export([self.customer], self.outfile) 68 89 result = open(self.outfile, 'rb').read() … … 81 102 # set values we can expect in export file 82 103 self.setup_customer(self.customer) 83 exporter = Customer sExporter()104 exporter = CustomerExporter() 84 105 exporter.export_all(self.app, self.outfile) 85 106 result = open(self.outfile, 'rb').read() … … 96 117 # we can export a single customer 97 118 self.setup_customer(self.customer) 98 exporter = Customer sExporter()119 exporter = CustomerExporter() 99 120 exporter.export_customer(self.customer, self.outfile) 100 121 result = open(self.outfile, 'rb').read() … … 108 129 return 109 130 110 class CustomerDocument sExporterTest(CustomerImportExportSetup):131 class CustomerDocumentExporterTest(CustomerImportExportSetup): 111 132 112 133 layer = FunctionalLayer 113 134 114 135 def setUp(self): 115 super(CustomerDocument sExporterTest, self).setUp()136 super(CustomerDocumentExporterTest, self).setUp() 116 137 self.setup_for_export() 117 138 return … … 119 140 def test_ifaces(self): 120 141 # make sure we fullfill interface contracts 121 obj = CustomerDocument sExporter()142 obj = CustomerDocumentExporter() 122 143 verifyObject(ICSVCustomerExporter, obj) 123 verifyClass(ICSVCustomerExporter, CustomerDocument sExporter)144 verifyClass(ICSVCustomerExporter, CustomerDocumentExporter) 124 145 return 125 146 … … 133 154 # we can export a nearly empty document 134 155 document = CustomerSampleDocument() 135 exporter = CustomerDocument sExporter()156 exporter = CustomerDocumentExporter() 136 157 exporter.export([document], self.outfile) 137 158 result = open(self.outfile, 'rb').read() … … 148 169 self.setup_customer(self.customer) 149 170 document = self.customer['documents']['d101'] 150 exporter = CustomerDocument sExporter()171 exporter = CustomerDocumentExporter() 151 172 exporter.export([document], self.outfile) 152 173 result = open(self.outfile, 'rb').read() … … 167 188 # set values we can expect in export file 168 189 self.setup_customer(self.customer) 169 exporter = CustomerDocument sExporter()190 exporter = CustomerDocumentExporter() 170 191 exporter.export_all(self.app, self.outfile) 171 192 result = open(self.outfile, 'rb').read() … … 185 206 # set values we can expect in export file 186 207 self.setup_customer(self.customer) 187 exporter = CustomerDocument sExporter()208 exporter = CustomerDocumentExporter() 188 209 exporter.export_customer(self.customer, self.outfile) 189 210 result = open(self.outfile, 'rb').read()
Note: See TracChangeset for help on using the changeset viewer.