Beispiel #1
0
    def test_insert_into(self):
        sql_runner = SQLRunner()
        table = sql_runner.execute_alter_file()
        table_values = sql_runner.execute_insert_file()
        test = table_values.execute("SELECT * FROM planets").fetchall()

        self.assertEqual(len(test), 9)
def test_insert_into():
    sql_runner = SQLRunner()
    table = sql_runner.execute_alter_file()
    table_values = sql_runner.execute_insert_file()
    test = table_values.execute("SELECT * FROM planets").fetchall()

    assert len(test) == 9
Beispiel #3
0
    def test_delete_from(self):
        sql_runner = SQLRunner()
        table = sql_runner.execute_alter_file()
        table_values = sql_runner.execute_insert_file()
        deletion = sql_runner.execute_delete_file()
        test_delete = deletion.execute("SELECT * FROM planets").fetchall()

        self.assertEqual(len(test_delete), 8, "Delete Pluto!")
Beispiel #4
0
    def test_alter_table(self):
        sql_runner = SQLRunner()
        altered_table = sql_runner.execute_alter_file()
        planets = altered_table.execute(
            "SELECT name FROM sqlite_master WHERE type='table';").fetchone()[0]
        results = altered_table.execute("PRAGMA table_info('%s')" %
                                        planets).fetchall()

        self.assertEqual(results[-1][1], 'rings', 'rings not set to BOOLEAN')
        self.assertEqual(results[-1][2], 'BOOLEAN', 'rings not set to BOOLEAN')
def test_update_jupiter():
    sql_runner = SQLRunner()
    table = sql_runner.execute_alter_file()
    table_values = sql_runner.execute_insert_file()
    update = sql_runner.execute_update_file()
    result = 68

    assert table_values.execute(
        "SELECT num_of_moons FROM planets WHERE name = 'Jupiter';").fetchone(
        )[0] == result