예제 #1
0
    def _retrieve_collectables(self, versioned):
        """
        check that none of these rows appear in any other result.
        check that the rows from other results are not included here.
        """
        sql_text = collectable_archive(_test_collection_id,
                                       versioned=versioned)

        args = {
            "collection_id": _test_collection_id,
        }

        cursor = self._connection.cursor()
        cursor.execute(sql_text, args)
        rows = cursor.fetchall()
        cursor.close()

        # there should always be some garbage. If there's not, something's
        # wrong.
        self.assertGreater(len(rows), 0)

        return set([(
            r["key"],
            r["unified_id"],
        ) for r in rows])
    def test_no_such_collectable(self):
        """
        test that there are no collectable rows for a bogus unified_id
        """
        log = logging.getLogger("test_no_such_collectable")

        sql_text = collectable_archive(_test_collection_id, 
                                       versioned=True, 
                                       key=_test_key, 
                                       unified_id=_test_no_such_unified_id)

        args = {"collection_id" : _test_collection_id,
                "key"           : _test_key,
                "unified_id"    : _test_no_such_unified_id}

        cursor = self._connection.cursor()
        cursor.execute(sql_text, args)
        rows = cursor.fetchall()
        cursor.close()
        self.assertEqual(len(rows), 0, rows)
    def _retrieve_collectables(self, versioned):
        """
        check that none of these rows appear in any other result.
        check that the rows from other results are not included here.
        """
        sql_text = collectable_archive(_test_collection_id, 
                                       versioned=versioned)

        args = {"collection_id" : _test_collection_id,
                }

        cursor = self._connection.cursor()
        cursor.execute(sql_text, args)
        rows = cursor.fetchall()
        cursor.close()

        # there should always be some garbage. If there's not, something's
        # wrong.
        self.assertGreater(len(rows), 0)

        return set([(r["key"], r["unified_id"], ) for r in rows])
예제 #4
0
    def test_no_such_collectable(self):
        """
        test that there are no collectable rows for a bogus unified_id
        """
        log = logging.getLogger("test_no_such_collectable")

        sql_text = collectable_archive(_test_collection_id,
                                       versioned=True,
                                       key=_test_key,
                                       unified_id=_test_no_such_unified_id)

        args = {
            "collection_id": _test_collection_id,
            "key": _test_key,
            "unified_id": _test_no_such_unified_id
        }

        cursor = self._connection.cursor()
        cursor.execute(sql_text, args)
        rows = cursor.fetchall()
        cursor.close()
        self.assertEqual(len(rows), 0, rows)