def test_zero_nonempty(self) -> None: self.conn.cursor().execute("create table x (x int primary key)") with self.assertRaises(dbver.VersionError): dbver.check_application_id(1, self.conn) with self.assertRaises(dbver.VersionError): dbver.check_application_id(1, self.conn, "main")
def test_zero_nonempty_other(self) -> None: self.conn.cursor().execute('create table "other schema".x ' "(x int primary key)") with self.assertRaises(dbver.VersionError): dbver.check_application_id(1, self.conn, "other schema")
def test_unexpected_other(self) -> None: self.conn.cursor().execute('pragma "other schema".application_id = 2') with self.assertRaises(dbver.VersionError): dbver.check_application_id(1, self.conn, "other schema")
def test_unprovisioned(self) -> None: dbver.check_application_id(1, self.conn) dbver.check_application_id(1, self.conn, "main") dbver.check_application_id(1, self.conn, "other schema")
def test_unexpected(self) -> None: self.conn.cursor().execute("pragma application_id = 2") with self.assertRaises(dbver.VersionError): dbver.check_application_id(1, self.conn) with self.assertRaises(dbver.VersionError): dbver.check_application_id(1, self.conn, "main")
def test_expected_nonempty_other(self) -> None: self.conn.cursor().execute('pragma "other schema".application_id = 1') self.conn.cursor().execute('create table "other schema".x ' "(x int primary key)") dbver.check_application_id(1, self.conn, "other schema")
def test_expected_nonempty(self) -> None: self.conn.cursor().execute("pragma application_id = 1") self.conn.cursor().execute("create table x (x int primary key)") dbver.check_application_id(1, self.conn) dbver.check_application_id(1, self.conn, "main")
def test_expected_empty_other(self) -> None: self.conn.cursor().execute('pragma "other schema".application_id = 1') dbver.check_application_id(1, self.conn, "other schema")
def test_expected_empty(self) -> None: self.conn.cursor().execute("pragma application_id = 1") dbver.check_application_id(1, self.conn) dbver.check_application_id(1, self.conn, "main")