Пример #1
0
 def check():
     table = self.i.t.sasync_items
     for name, inserted in items.iteritems():
         value = table.select(
             and_(table.c.group_id == 123, table.c.name ==
                  name)).execute().fetchone()['value']
         msg = "Inserted '{}:{}' ".format(name, inserted) +\
               "but read '{}' back from the database!".format(value)
         self.failUnlessEqual(value, inserted, msg)
         for otherName, otherValue in items.iteritems():
             if otherName != name and value == otherValue:
                 self.fail(
                     "Inserted item '%s' is equal to item '%s'" % \
                     (name, otherName))
Пример #2
0
 def check():
     table = self.i.t.sasync_items
     for name, inserted in items.iteritems():
         value = (
             table.select(and_(table.c.group_id == 123, table.c.name == name)).execute().fetchone()["value"]
         )
         self.failUnlessEqual(
             value,
             inserted,
             "Inserted '%s:%s' but read '%s' back from the database!" % (name, inserted, value),
         )
         for otherName, otherValue in items.iteritems():
             if otherName != name and value == otherValue:
                 self.fail("Inserted item '%s' is equal to item '%s'" % (name, otherName))
Пример #3
0
 def check():
     table = self.i.t.sasync_items
     for name, inserted in items.iteritems():
         value = table.select(
             and_(table.c.group_id == 123,
                  table.c.name == name)
             ).execute().fetchone()['value']
         msg = "Inserted '{}:{}' ".format(name, inserted) +\
               "but read '{}' back from the database!".format(value)
         self.failUnlessEqual(value, inserted, msg)
         for otherName, otherValue in items.iteritems():
             if otherName != name and value == otherValue:
                 self.fail(
                     "Inserted item '%s' is equal to item '%s'" % \
                     (name, otherName))
Пример #4
0
    def test_insertAndLoadAll(self):
        items = {'a':0, 'b':1, 'c':2, 'd':3, 'e':4}
        def first(null):
            return self.i.loadAll().addCallback(second)
        def second(loadedItems):
            self.failUnlessEqual(loadedItems, items)

        dL = []
        for name, value in items.iteritems():
            dL.append(self.i.insert(name, value))
        return DeferredList(dL).addCallback(first)
Пример #5
0
    def testInsertAndLoadAll(self):
        items = {'a':0, 'b':1, 'c':2, 'd':3, 'e':4}
        def first(null):
            return self.i.loadAll().addCallback(second)
        def second(loadedItems):
            self.failUnlessEqual(loadedItems, items)

        dL = []
        for name, value in items.iteritems():
            dL.append(self.i.insert(name, value))
        return DeferredList(dL).addCallback(first)
Пример #6
0
    def testInsertAndLoadAll(self):
        items = {"a": 0, "b": 1, "c": 2, "d": 3, "e": 4}

        def first(null):
            return self.i.loadAll().addCallback(second)

        def second(loadedItems):
            self.failUnlessEqual(loadedItems, items)

        dL = []
        for name, value in items.iteritems():
            dL.append(self.i.insert(name, value))
        return DeferredList(dL).addCallback(first)
Пример #7
0
    def test_insertAndUpdate(self):
        items = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4}

        def first(null):
            return self.i.update('b', 10).addCallback(second)

        def second(null):
            return self.i.loadAll().addCallback(third)

        def third(loadedItems):
            expectedItems = {'a': 0, 'b': 10, 'c': 2, 'd': 3, 'e': 4}
            self.failUnlessEqual(loadedItems, expectedItems)

        dL = []
        for name, value in items.iteritems():
            dL.append(self.i.insert(name, value))
        return DeferredList(dL).addCallback(first)
Пример #8
0
    def test_insertAndDelete(self):
        items = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4}

        def first(null):
            return self.i.delete('c').addCallback(second)

        def second(null):
            return self.i.names().addCallback(third)

        def third(nameList):
            desiredList = [x for x in items.keys() if x != 'c']
            desiredList.sort()
            nameList.sort()
            self.failUnlessEqual(nameList, desiredList)

        dL = []
        for name, value in items.iteritems():
            dL.append(self.i.insert(name, value))
        return DeferredList(dL).addCallback(first)
Пример #9
0
    def test_insertAndDelete(self):
        items = {'a':0, 'b':1, 'c':2, 'd':3, 'e':4}

        def first(null):
            return self.i.delete('c').addCallback(second)

        def second(null):
            return self.i.names().addCallback(third)

        def third(nameList):
            desiredList = [x for x in items.keys() if x != 'c']
            desiredList.sort()
            nameList.sort()
            self.failUnlessEqual(nameList, desiredList)

        dL = []
        for name, value in items.iteritems():
            dL.append(self.i.insert(name, value))
        return DeferredList(dL).addCallback(first)
Пример #10
0
    def testInsertAndDelete(self):
        items = {"a": 0, "b": 1, "c": 2, "d": 3, "e": 4}

        def first(null):
            return self.i.delete("c").addCallback(second)

        def second(null):
            return self.i.names().addCallback(third)

        def third(nameList):
            desiredList = [x for x in items.keys() if x != "c"]
            desiredList.sort()
            nameList.sort()
            self.failUnlessEqual(nameList, desiredList)

        dL = []
        for name, value in items.iteritems():
            dL.append(self.i.insert(name, value))
        return DeferredList(dL).addCallback(first)