Ejemplo n.º 1
0
def delete_character_inventories(conn, char_id):
    sql.execute_sql(conn, sql.delete_all('inventories', 'character_id'),
                    char_id)
Ejemplo n.º 2
0
def delete_all_character_items(conn, char_id):
    sql.execute_sql(conn, sql.delete_all('items', 'character_id'), char_id)
Ejemplo n.º 3
0
 def test_delete_character_inventories(self):
     with mock.patch('database.sqlite3') as mocksql:
         conn = mocksql.connect()
         database.delete_character_inventories(conn, 1)
         mocksql.connect().execute.assert_called_with(
             sql.delete_all('inventories', 'character_id'), (1, ))
Ejemplo n.º 4
0
def delete_character(conn, char_id):
    delete_all_character_items(conn, char_id)
    delete_character_inventories(conn, char_id)
    sql.execute_sql(conn, sql.delete_all('characters', 'id'), char_id)
Ejemplo n.º 5
0
 def test_sql_delete(self):
     self.assertEqual(sql.delete_all('items', 'character_id'),
                      """DELETE FROM items WHERE character_id = ?""")