Changeset 12094 for main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests
- Timestamp:
- 30 Nov 2014, 08:12:27 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12093 r12094 1073 1073 self.browser.getLink("a102").click() 1074 1074 self.browser.getLink("Manage").click() 1075 self.browser.getControl(name="form.product").value = ['SAM'] 1075 1076 self.browser.getControl(name="form.title").value = 'My second app' 1076 1077 self.browser.getControl("Save").click() … … 1144 1145 # ... but NOTSAM not. 1145 1146 self.assertFalse('<option value="LIC">' in self.browser.contents) 1147 # So far last_product_id is None. 1148 self.assertTrue(self.customer['applications']['a102'].last_product_id is None) 1146 1149 self.browser.getControl(name="form.product").value = ['SAM'] 1147 1150 self.browser.getControl("Save").click() 1151 # After saving the form, last_product_id is set. 1152 self.assertEqual(self.customer['applications']['a102'].last_product_id, 'SAM') 1153 self.assertTrue('Form has been saved.' in self.browser.contents) 1154 # Saving the form again does not unset last_product_id 1148 1155 self.assertEqual(application.title, 'My second app') 1156 self.browser.getControl("Save").click() 1157 self.assertEqual(self.customer['applications']['a102'].last_product_id, 'SAM') 1149 1158 self.assertTrue('Form has been saved.' in self.browser.contents) 1150 1159 self.browser.getLink("View").click() … … 1153 1162 self.browser.getLink("Edit").click() 1154 1163 self.browser.getControl(name="form.title").value = 'My third app' 1155 self.browser.getControl(" Final Submit").click()1164 self.browser.getControl("Apply now").click() 1156 1165 self.assertEqual(application.title, 'My third app') 1157 1166 self.assertEqual(application.state, 'submitted') -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py
r11997 r12094 1 ## $Id : test_catalog.py 10552 2013-08-28 14:33:33Z henrik$1 ## $Id$ 2 2 ## 3 3 ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann … … 26 26 from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase 27 27 from waeup.ikoba.customers.customer import Customer 28 from waeup.ikoba.customers.applications import SampleApplication 29 28 30 29 31 class CatalogTestSetup(FunctionalTestCase): … … 54 56 self.customer_id = customer.customer_id 55 57 self.customer = self.app['customers'][self.customer_id] 56 # Update the customers_catalog 57 notify(grok.ObjectModifiedEvent(self.customer)) 58 59 product = createObject('waeup.Product') 60 product.product_id = u'SAM' 61 product.title = u'Our Samle Product' 62 product.application_category = u'sample' 63 self.app['products'].addProduct(product) 64 self.product_id = product.product_id 65 self.product = self.app['products'][self.product_id] 66 67 application = createObject('waeup.SampleApplication') 68 application.title = u'My Samle Application' 69 application.product = product 70 application.last_product_id = product.product_id 71 self.customer['applications'].addApplication(application) 72 self.application_id = application.application_id 73 self.application = self.customer['applications'][self.application_id] 74 75 document = createObject('waeup.CustomerSampleDocument') 76 document.title = u'My Samle Document' 77 self.customer['documents'].addDocument(document) 78 self.document_id = document.document_id 79 self.document = self.customer['documents'][self.document_id] 80 58 81 return 59 82 … … 63 86 return 64 87 65 class CustomerCatalogTests(CatalogTestSetup): 88 89 class CustomersCatalogTests(CatalogTestSetup): 66 90 67 91 layer = FunctionalLayer … … 88 112 assert len(results) == 1 89 113 assert results[0] is self.app['customers'][self.customer_id] 114 115 116 class DocumentsCatalogTests(CatalogTestSetup): 117 118 layer = FunctionalLayer 119 120 def test_get_catalog(self): 121 # We can get an customers catalog if we wish 122 cat = queryUtility(ICatalog, name='documents_catalog') 123 assert cat is not None 124 125 def test_search_by_id(self): 126 # We can find a certain application id 127 cat = queryUtility(ICatalog, name='documents_catalog') 128 results = cat.searchResults(document_id=(self.document_id, 129 self.document_id)) 130 results = [x for x in results] # Turn results generator into list 131 assert len(results) == 1 132 assert results[0] is self.customer['documents'][self.document_id] 133 134 135 class ApplicationsCatalogTests(CatalogTestSetup): 136 137 layer = FunctionalLayer 138 139 def test_get_catalog(self): 140 # We can get an customers catalog if we wish 141 cat = queryUtility(ICatalog, name='applications_catalog') 142 assert cat is not None 143 144 def test_search_by_id(self): 145 # We can find a certain application id 146 cat = queryUtility(ICatalog, name='applications_catalog') 147 results = cat.searchResults(application_id=(self.application_id, 148 self.application_id)) 149 results = [x for x in results] # Turn results generator into list 150 assert len(results) == 1 151 assert results[0] is self.customer['applications'][self.application_id] 152 153 def test_search_by_category(self): 154 # We can find a certain name 155 cat = queryUtility(ICatalog, name='applications_catalog') 156 results = cat.searchResults(application_category=('sample', 'sample')) 157 results = [x for x in results] # Turn results generator into list 158 assert len(results) == 1 159 assert results[0] is self.customer['applications'][self.application_id] 160 161 def test_search_by_last_product_id(self): 162 # We can find a certain name 163 cat = queryUtility(ICatalog, name='applications_catalog') 164 results = cat.searchResults(last_product_id=('SAM', 'SAM')) 165 results = [x for x in results] # Turn results generator into list 166 assert len(results) == 1 167 assert results[0] is self.customer['applications'][self.application_id] 168 assert results[0].product is self.product
Note: See TracChangeset for help on using the changeset viewer.