mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
Fix tests for encrypted databases
This commit is contained in:
1 parent
38bb8d3505
commit
4c8fc93fec
2 files changed
+20
-8
No files matched your search
@@ -30,7 +30,9 @@ final class DatabaseQueueInMemoryCopyTests: GRDBTestCase {
|
||||
|
||||
func test_inMemoryCopy() throws {
|
||||
let source = try makeSourceDatabase()
|
||||
let dbQueue = try DatabaseQueue.inMemoryCopy(fromPath: source.path)
|
||||
let dbQueue = try DatabaseQueue.inMemoryCopy(
|
||||
fromPath: source.path,
|
||||
configuration: dbConfiguration)
|
||||
|
||||
// Test that content was faithfully copied
|
||||
let stream = TestStream()
|
||||
@@ -48,7 +50,9 @@ final class DatabaseQueueInMemoryCopyTests: GRDBTestCase {
|
||||
|
||||
func test_inMemoryCopy_write() throws {
|
||||
let source = try makeSourceDatabase()
|
||||
let dbQueue = try DatabaseQueue.inMemoryCopy(fromPath: source.path)
|
||||
let dbQueue = try DatabaseQueue.inMemoryCopy(
|
||||
fromPath: source.path,
|
||||
configuration: dbConfiguration)
|
||||
|
||||
// The in-memory copy is writable (necessary for testing migrations)
|
||||
try dbQueue.write { db in
|
||||
@@ -70,7 +74,7 @@ final class DatabaseQueueInMemoryCopyTests: GRDBTestCase {
|
||||
|
||||
func test_inMemoryCopy_readOnly() throws {
|
||||
let source = try makeSourceDatabase()
|
||||
var config = Configuration()
|
||||
var config = dbConfiguration!
|
||||
config.readonly = true
|
||||
let dbQueue = try DatabaseQueue.inMemoryCopy(fromPath: source.path, configuration: config)
|
||||
|
||||
@@ -116,7 +120,9 @@ final class DatabaseQueueInMemoryCopyTests: GRDBTestCase {
|
||||
|
||||
// …GRDB users can test the migrator on fixtures
|
||||
let source = try makeSourceDatabase()
|
||||
let dbQueue = try DatabaseQueue.inMemoryCopy(fromPath: source.path)
|
||||
let dbQueue = try DatabaseQueue.inMemoryCopy(
|
||||
fromPath: source.path,
|
||||
configuration: dbConfiguration)
|
||||
|
||||
try migrator.migrate(dbQueue, upTo: "v2")
|
||||
do {
|
||||
|
||||
@@ -30,7 +30,9 @@ final class DatabaseQueueTemporaryCopyTests: GRDBTestCase {
|
||||
|
||||
func test_temporaryCopy() throws {
|
||||
let source = try makeSourceDatabase()
|
||||
let dbQueue = try DatabaseQueue.temporaryCopy(fromPath: source.path)
|
||||
let dbQueue = try DatabaseQueue.temporaryCopy(
|
||||
fromPath: source.path,
|
||||
configuration: dbConfiguration)
|
||||
|
||||
// Test that content was faithfully copied
|
||||
let stream = TestStream()
|
||||
@@ -48,7 +50,9 @@ final class DatabaseQueueTemporaryCopyTests: GRDBTestCase {
|
||||
|
||||
func test_temporaryCopy_write() throws {
|
||||
let source = try makeSourceDatabase()
|
||||
let dbQueue = try DatabaseQueue.temporaryCopy(fromPath: source.path)
|
||||
let dbQueue = try DatabaseQueue.temporaryCopy(
|
||||
fromPath: source.path,
|
||||
configuration: dbConfiguration)
|
||||
|
||||
// The in-memory copy is writable (necessary for testing migrations)
|
||||
try dbQueue.write { db in
|
||||
@@ -70,7 +74,7 @@ final class DatabaseQueueTemporaryCopyTests: GRDBTestCase {
|
||||
|
||||
func test_temporaryCopy_readOnly() throws {
|
||||
let source = try makeSourceDatabase()
|
||||
var config = Configuration()
|
||||
var config = dbConfiguration!
|
||||
config.readonly = true
|
||||
let dbQueue = try DatabaseQueue.temporaryCopy(fromPath: source.path, configuration: config)
|
||||
|
||||
@@ -116,7 +120,9 @@ final class DatabaseQueueTemporaryCopyTests: GRDBTestCase {
|
||||
|
||||
// …GRDB users can test the migrator on fixtures
|
||||
let source = try makeSourceDatabase()
|
||||
let dbQueue = try DatabaseQueue.temporaryCopy(fromPath: source.path)
|
||||
let dbQueue = try DatabaseQueue.temporaryCopy(
|
||||
fromPath: source.path,
|
||||
configuration: dbConfiguration)
|
||||
|
||||
try migrator.migrate(dbQueue, upTo: "v2")
|
||||
do {
|
||||
|
||||
Reference in new issue
Block a user