Exemplo n.º 1
0
 def test_synchronous(self):
     synchronous_values = {"OFF": 0, "NORMAL": 1, "FULL": 2}
     for value in synchronous_values:
         database = SQLite(
             URI("sqlite:%s?synchronous=%s" % (self.get_path(), value)))
         connection = database.connect()
         result = connection.execute("PRAGMA synchronous")
         self.assertEqual(result.get_one()[0], synchronous_values[value])
Exemplo n.º 2
0
 def test_foreign_keys(self):
     foreign_keys_values = {"ON": 1, "OFF": 0}
     for value in foreign_keys_values:
         database = SQLite(
             URI("sqlite:%s?foreign_keys=%s" % (self.get_path(), value)))
         connection = database.connect()
         result = connection.execute("PRAGMA foreign_keys").get_one()[0]
         self.assertEqual(result, foreign_keys_values[value])
Exemplo n.º 3
0
 def test_synchronous(self):
     synchronous_values = {"OFF": 0, "NORMAL": 1, "FULL": 2}
     for value in synchronous_values:
         database = SQLite(URI("sqlite:%s?synchronous=%s" %
                               (self.get_path(), value)))
         connection = database.connect()
         result = connection.execute("PRAGMA synchronous")
         self.assertEquals(result.get_one()[0],
                           synchronous_values[value])
Exemplo n.º 4
0
 def test_foreign_keys(self):
     foreign_keys_values = {"ON": 1, "OFF": 0}
     for value in foreign_keys_values:
         database = SQLite(URI("sqlite:%s?foreign_keys=%s" %
                               (self.get_path(), value)))
         connection = database.connect()
         result = connection.execute("PRAGMA foreign_keys").get_one()[0]
         self.assertEquals(result,
                           foreign_keys_values[value])
Exemplo n.º 5
0
 def test_foreign_keys_persistency_to_rollback(self):
     foreign_keys_values = {"ON": 1, "OFF": 0}
     for value in foreign_keys_values:
         database = SQLite(
             URI("sqlite:%s?foreign_keys=%s" % (self.get_path(), value)))
         connection = database.connect()
         connection.execute("CREATE TABLE test (id INTEGER PRIMARY KEY)")
         connection.rollback()
         result = connection.execute("PRAGMA foreign_keys").get_one()[0]
         self.assertEqual(result, foreign_keys_values[value])
Exemplo n.º 6
0
 def test_foreign_keys_persistency_to_rollback(self):
     foreign_keys_values = {"ON": 1, "OFF": 0}
     for value in foreign_keys_values:
         database = SQLite(URI("sqlite:%s?foreign_keys=%s" %
                               (self.get_path(), value)))
         connection = database.connect()
         connection.execute("CREATE TABLE test (id INTEGER PRIMARY KEY)")
         connection.rollback()
         result = connection.execute("PRAGMA foreign_keys").get_one()[0]
         self.assertEquals(result,
                           foreign_keys_values[value])
Exemplo n.º 7
0
 def test_journal(self):
     journal_values = {"DELETE": u'delete', "TRUNCATE": u'truncate',
                       "PERSIST": u'persist', "MEMORY": u'memory',
                       "WAL": u'wal', "OFF": u'off'}
     for value in journal_values:
         database = SQLite(URI("sqlite:%s?journal_mode=%s" %
                               (self.get_path(), value)))
         connection = database.connect()
         result = connection.execute("PRAGMA journal_mode").get_one()[0]
         self.assertEquals(result,
                           journal_values[value])
Exemplo n.º 8
0
 def test_journal(self):
     journal_values = {
         "DELETE": u'delete',
         "TRUNCATE": u'truncate',
         "PERSIST": u'persist',
         "MEMORY": u'memory',
         "WAL": u'wal',
         "OFF": u'off'
     }
     for value in journal_values:
         database = SQLite(
             URI("sqlite:%s?journal_mode=%s" % (self.get_path(), value)))
         connection = database.connect()
         result = connection.execute("PRAGMA journal_mode").get_one()[0]
         self.assertEqual(result, journal_values[value])
Exemplo n.º 9
0
 def test_journal_persistency_to_rollback(self):
     journal_values = {
         "DELETE": u'delete',
         "TRUNCATE": u'truncate',
         "PERSIST": u'persist',
         "MEMORY": u'memory',
         "WAL": u'wal',
         "OFF": u'off'
     }
     for value in journal_values:
         database = SQLite(
             URI("sqlite:%s?journal_mode=%s" % (self.get_path(), value)))
         connection = database.connect()
         connection.execute("CREATE TABLE test (id INTEGER PRIMARY KEY)")
         connection.rollback()
         result = connection.execute("PRAGMA journal_mode").get_one()[0]
         assert result == journal_values[value]