Ejemplo n.º 1
0
    def test_wallet_dupes(self):
        """
        Rather pointless to test the ORM itself, but I had gotten
        this wrong initially.
        """
        newwallet0 = self.get_wallet(0)
        session.add(newwallet0)
        session.commit()

        dupe = False
        newwallet1 = self.get_wallet(1)
        try:
            session.add(newwallet1)
            session.commit()
            dupe = True
        except IntegrityError:
            session.rollback()
        self.assertFalse(
            dupe,
            'Unique DB constraint was ignored',
        )
        session.delete(newwallet0)
        session.commit()
Ejemplo n.º 2
0
    def test_wallet_dupes(self):
        """
        Rather pointless to test the ORM itself, but I had gotten
        this wrong initially.
        """
        newwallet0 = self.get_wallet(0)
        session.add(newwallet0)
        session.commit()

        dupe = False
        newwallet1 = self.get_wallet(1)
        try:
            session.add(newwallet1)
            session.commit()
            dupe = True
        except IntegrityError:
            session.rollback()
        self.assertFalse(
            dupe,
            'Unique DB constraint was ignored',
        )
        session.delete(newwallet0)
        session.commit()
Ejemplo n.º 3
0
def tearDownModule():
    wallets = Wallet.query.all()
    for wallet in wallets:
        session.delete(wallet)
        session.commit()
Ejemplo n.º 4
0
 def dispatch_request(self, name):
     setting = Setting.query.filter(Setting.name==name).first()
     session.delete(setting)
     session.commit()
     flash(u"%s: Setting deleted" % name, 'success')
     return redirect(url_for("settings.list"))
Ejemplo n.º 5
0
 def dispatch_request(self, id):
     super(WalletDeleteView, self).dispatch_request(id)
     session.delete(self.wallet)
     session.commit()
     flash(u"%s: Wallet deleted" % self.wallet.label, 'success')
     return redirect(url_for("wallet.wallet_list"))
Ejemplo n.º 6
0
def tearDownModule():
    wallets = Wallet.query.all()
    for wallet in wallets:
        session.delete(wallet)
        session.commit()
Ejemplo n.º 7
0
 def dispatch_request(self, id):
     super(WalletDeleteView, self).dispatch_request(id)
     session.delete(self.wallet)
     session.commit()
     flash(u"%s: Wallet deleted" % self.wallet.label, 'success')
     return redirect(url_for("wallet.wallet_list"))