Changeset 9267


Ignore:
Timestamp:
2 Oct 2012, 07:34:48 (12 years ago)
Author:
Henrik Bettermann
Message:

Check counters (used_num and disabled_num) in test.

Display disabled_num on batchcontainer page.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/accesscodes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/batching.py

    r9266 r9267  
    187187        items_changed = ''
    188188        # Update state
     189        # Attention: When importing states the counters remain unchanged.
    189190        if row.has_key('state'):
    190191            state = row.get('state', IGNORE_MARKER)
     
    196197                IObjectHistory(obj).addMessage(msg)
    197198            row.pop('state')
    198         # Fire transition
     199        # Trigger transition. Counters are properly changed.
    199200        if row.has_key('transition'):
    200201            transition = row.get('transition', IGNORE_MARKER)
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/browser.txt

    r9260 r9267  
    114114    ...
    115115    ...5
    116     .../
     116    ...
    117117    ...0
    118118    ...
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/browser_templates/batchcontainer.pt

    r9245 r9267  
    88        <th>&nbsp;</th>
    99        <th i18n:translate="">Prefix</th>
    10         <th i18n:translate="">Entries/(invalidated)</th>
     10        <th i18n:translate="">Entries</th>
     11        <th i18n:translate="">Used</th>
     12        <th i18n:translate="">Disabled</th>
    1113        <th i18n:translate="">Cost</th>
    1214        <th i18n:translate="">Date of Creation</th>
     
    2830  <td>
    2931    <span tal:replace="batch/entry_num">1012</span>
    30     /
     32  </td>
     33  <td>
    3134    <span tal:replace="batch/used_num">512</span>
     35  </td>
     36  <td>
     37    <span tal:replace="batch/disabled_num">112</span>
    3238  </td>
    3339  <td tal:content="batch/cost">12.12</td>
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_batching.py

    r9266 r9267  
    180180            self.csv_file, AC_HEADER_FIELDS)
    181181
     182        self.assertEqual(self.app['accesscodes']['HOS-1'].used_num, 1)
     183        self.assertEqual(self.app['accesscodes']['HOS-1'].disabled_num, 0)
     184        self.assertEqual(self.app['accesscodes']['CLR-1'].used_num, 1)
     185        self.assertEqual(self.app['accesscodes']['CLR-1'].disabled_num, 0)
     186
    182187        self.csv_file = os.path.join(self.workdir, 'sample_ac_data_update.csv')
    183188        open(self.csv_file, 'wb').write(AC_SAMPLE_DATA_UPDATE)
     
    200205            "|<YYYY-MM-DD hh:mm:ss> UTC - used by system|"
    201206            "|<YYYY-MM-DD hh:mm:ss> UTC - disabled by system")
     207        # When importing transitions the counters are properly set.
     208        self.assertEqual(self.app['accesscodes']['HOS-1'].used_num, 0)
     209        self.assertEqual(self.app['accesscodes']['HOS-1'].disabled_num, 1)
     210        # When importing states the counters remain unchanged.
     211        self.assertEqual(self.app['accesscodes']['CLR-1'].used_num, 1)
     212        self.assertEqual(self.app['accesscodes']['CLR-1'].disabled_num, 0)
    202213        return
Note: See TracChangeset for help on using the changeset viewer.