Ignore:
Timestamp:
5 Aug 2013, 06:07:53 (11 years ago)
Author:
Henrik Bettermann
Message:

Add TSC access code batch.

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

Legend:

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

    r10028 r10448  
    344344        """Get next unused num for given prefix.
    345345        """
    346         # School fee, clearance and hostel application batches start with 0.
    347         # These batches are being emptily created during initialization of the
    348         # university instance.
    349         if prefix in ('CLR', 'SFE', 'HOS'):
     346        # School fee, clearance, hostel application and transcript
     347        # batches start with 0.These batches are being emptily
     348        # created during initialization of the university instance.
     349        if prefix in ('CLR', 'SFE', 'HOS', 'TSC'):
    350350            num = 0
    351351        else:
     
    450450        site['accesscodes'] = basecontainer
    451451        logger.info('Installed container for access code batches.')
    452         # Create empty school fee, clearance and hostel application AC
     452        # Create empty school fee, clearance, hostel application
     453        # and transcript AC
    453454        # batches during initialization of university instance.
    454455        cost = 0.0
     
    462463        basecontainer.createBatch(creation_date, creator,
    463464            'HOS', cost, entry_num)
    464         logger.info('Installed empty SFE, CLR and HOS access code batches.')
     465        basecontainer.createBatch(creation_date, creator,
     466            'TSC', cost, entry_num)
     467        logger.info('Installed empty SFE, CLR, HOS and TSC access code batches.')
    465468        return
    466469
     
    475478                'AccessCodePlugin: Updating site at %s: Nothing to do.' % (
    476479                    site_name, ))
     480        if not 'TSC' in site['accesscodes']:
     481            site['accesscodes'].createBatch(datetime.utcnow(), 'system',
     482                'TSC', 0.0, 0)
     483            logger.info('Empty TSC access code batch added.')
    477484        return
    478485
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_accesscode.py

    r9260 r10448  
    354354        assert verifyObject(IAccessCodeBatchContainer, accesscodes)
    355355        assert verifyClass(IAccessCodeBatchContainer, AccessCodeBatchContainer)
     356
     357    def test_existing_batches(self):
     358        self.assertEqual(sorted(self.app['accesscodes'].keys()),
     359            [u'BAR-1', u'CLR-0', u'HOS-0', u'SFE-0', u'TSC-0'])
    356360
    357361    def test_csv_import(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/accesscodes/tests/test_batching.py

    r9706 r10448  
    107107            self.csv_file, BATCH_HEADER_FIELDS)
    108108        self.assertEqual(num_warns,0)
    109         self.assertEqual(len(self.app['accesscodes'].keys()), 7)
     109        self.assertEqual(len(self.app['accesscodes'].keys()), 8)
    110110        self.assertEqual(self.app['accesscodes']['CLR-1'].num,1)
    111111        logcontent = open(self.logfile).read()
Note: See TracChangeset for help on using the changeset viewer.