mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-26 04:07:50 +00:00
SQLCipher: test compatibility between Configuration.passphrase and PRAGMA key
This commit is contained in:
1 parent
08de2cc920
commit
627bca09c0
1 file changed
+16
-2
@@ -193,7 +193,21 @@ class EncryptionTests: GRDBTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testPragmaCompatibility() {
|
||||
|
||||
func testDatabaseQueueWithPragmaPassphraseToDatabaseQueueWithPassphrase() {
|
||||
assertNoError {
|
||||
do {
|
||||
dbConfiguration.passphrase = nil
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
try dbQueue.execute("PRAGMA key = 'secret'")
|
||||
try dbQueue.execute("CREATE TABLE data (value INTEGER)")
|
||||
try dbQueue.execute("INSERT INTO data (value) VALUES (1)")
|
||||
}
|
||||
|
||||
do {
|
||||
dbConfiguration.passphrase = "secret"
|
||||
let dbQueue = try makeDatabaseQueue()
|
||||
XCTAssertEqual(Int.fetchOne(dbQueue, "SELECT value FROM data")!, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user