SQLCipher: test compatibility between Configuration.passphrase and PRAGMA key

This commit is contained in:
Gwendal Roué committed 2016-04-03 22:57:12 +02:00
1 parent 08de2cc920
commit 627bca09c0
1 file changed
+16 -2
+16 -2
View File
@@ -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)
}
}
}
}