예제 #1
0
    def test_refund_cdr_generation(self):
        exp_cdr = [{
            'provider': 'provider',
            'correlation': '1',
            'order': '1 3',
            'offering': '4 offering 1.0',
            'product_class': 'one time',
            'description': 'Refund event: 10 EUR',
            'cost_currency': 'EUR',
            'cost_value': '10',
            'tax_value': '2',
            'customer': 'customer',
            'event': 'Refund event',
            'time_stamp': u'2015-10-21 06:13:26.661650',
            'type': 'R'
        }]

        cdr_m = cdr_manager.CDRManager(self._order, self._contract)
        cdr_m.refund_cdrs(Decimal('10'), Decimal('8'),
                          '2015-10-21 06:13:26.661650')

        # Validate calls
        self._conn.wstore_organization.find_and_modify.assert_called_once_with(
            query={'_id': ObjectId('61004aba5e05acc115f022f0')},
            update={'$inc': {
                'correlation_number': 1
            }})

        cdr_manager.RSSAdaptorThread.assert_called_once_with(exp_cdr)
        cdr_manager.RSSAdaptorThread().start.assert_called_once_with()
예제 #2
0
    def test_cdr_generation(self, name, applied_parts, exp_cdrs):

        cdr_m = cdr_manager.CDRManager(self._order, self._contract)
        cdr_m.generate_cdr(applied_parts, '2015-10-21 06:13:26.661650')

        # Validate calls
        self._conn.wstore_organization.find_and_modify.assert_called_once_with(
            query={'_id': ObjectId('61004aba5e05acc115f022f0')},
            update={'$inc': {
                'correlation_number': 1
            }})

        cdr_manager.RSSAdaptorThread.assert_called_once_with(exp_cdrs)
        cdr_manager.RSSAdaptorThread().start.assert_called_once_with()