Beispiel #1
0
 def test_setval_dupe(self):
     newsetting = Setting('testkey', u'teststring')
     session.add(newsetting)
     session.commit()
     newsetting = Setting('testkey', u'teststring')
     session.add(newsetting)
     dupe = False
     try:
         session.commit()
         dupe = True
     except IntegrityError:
         session.rollback()
     self.assertFalse(
         dupe,
         "Could set the same key twice",
     )
Beispiel #2
0
 def test_setval_dupe(self):
     newsetting = Setting('testkey', u'teststring')
     session.add(newsetting)
     session.commit()
     newsetting = Setting('testkey', u'teststring')
     session.add(newsetting)
     dupe = False
     try:
         session.commit()
         dupe = True
     except IntegrityError:
         session.rollback()
     self.assertFalse(
         dupe,
         "Could set the same key twice",
     )
Beispiel #3
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()
Beispiel #4
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()