def test_lower_schema_version(self):
        """Checks that lower schema version wouldn't work"""

        rcdb.model.Base.metadata.create_all(self.db.engine)
        v = SchemaVersion()
        v.version = 0
        self.db.session.add(v)
        self.db.session.commit()
        self.assertFalse(self.db.get_sql_schema_version())
    def test_lower_schema_version(self):
        """Checks that lower schema version wouldn't work"""

        rcdb.model.Base.metadata.create_all(self.db.engine)
        v = SchemaVersion()
        v.version = 0
        self.db.session.add(v)
        self.db.session.commit()
        self.assertFalse(self.db.is_acceptable_sql_version())
    def test_right_schema_version(self):
        """Test of Run in db function"""
        rcdb.model.Base.metadata.create_all(self.db.engine)
        v = SchemaVersion()
        v.version = rcdb.SQL_SCHEMA_VERSION

        self.db.session.add(v)
        self.db.session.commit()
        self.assertTrue(self.db.is_acceptable_sql_version())
    def test_right_schema_version(self):
        """Test of Run in db function"""
        rcdb.model.Base.metadata.create_all(self.db.engine)
        v = SchemaVersion()
        v.version = rcdb.SQL_SCHEMA_VERSION
        self.db.session.add(v)

        v = SchemaVersion()
        v.version = rcdb.SQL_SCHEMA_VERSION - 1
        self.db.session.add(v)
        self.db.session.commit()

        self.assertEqual(self.db.get_sql_schema_version(),
                         rcdb.SQL_SCHEMA_VERSION)