Beispiel #1
0
    def testLogEntryModify(self):
        """Checks that modifying log entry raises error"""

        log_entry = self.transaction.log_set.filter(type=Transaction.PENDING_STATE)[0]

        with self.assertRaises(InvalidTransactionLog):
            log_entry.save()

        for key, value in Transaction.TRANSACTION_STATE:
            log1 = TransactionLog(type=key, transaction=self.transaction, user=self.user)

            if key != Transaction.PENDING_STATE:
                log1.save()
                with self.assertRaises(InvalidTransactionLog):
                    log1.save()
Beispiel #2
0
    def testLogEntryUniqePerType(self):
        """Checks that only one log entry of each type is allowed (except for
        pending)
        """

        for key, value in Transaction.TRANSACTION_STATE:
            log1 = TransactionLog(type=key,
                                  transaction=self.transaction,
                                  user=self.user)
            log2 = TransactionLog(type=key,
                                  transaction=self.transaction,
                                  user=self.user)
            if key != Transaction.PENDING_STATE:
                log1.save()
                with self.assertRaises(InvalidTransactionLog):
                    log2.save()
Beispiel #3
0
    def testLogEntryUniqePerType(self):
        """Checks that only one log entry of each type is allowed (except for
        pending)
        """

        for key, value in Transaction.TRANSACTION_STATE:
            log1 = TransactionLog(type=key, transaction=self.transaction, user=self.user)
            log2 = TransactionLog(type=key, transaction=self.transaction, user=self.user)
            if key != Transaction.PENDING_STATE:
                log1.save()
                with self.assertRaises(InvalidTransactionLog):
                    log2.save()
Beispiel #4
0
    def testLogEntryModify(self):
        """Checks that modifying log entry raises error"""

        log_entry = self.transaction.log_set.filter(
            type=Transaction.PENDING_STATE)[0]

        with self.assertRaises(InvalidTransactionLog):
            log_entry.save()

        for key, value in Transaction.TRANSACTION_STATE:
            log1 = TransactionLog(type=key,
                                  transaction=self.transaction,
                                  user=self.user)

            if key != Transaction.PENDING_STATE:
                log1.save()
                with self.assertRaises(InvalidTransactionLog):
                    log1.save()