1# Copyright 2013 Christoph Reiter
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7
8from tests import TestCase, init_fake_app, destroy_fake_app
9
10from quodlibet import app
11from quodlibet import session
12from quodlibet.session import SessionError, iter_backends
13
14
15class TSession(TestCase):
16
17    def setUp(self):
18        init_fake_app()
19
20    def tearDown(self):
21        destroy_fake_app()
22
23    def test_session(self):
24        client = session.init(app)
25        client.close()
26
27    def test_all(self):
28        for backend in iter_backends():
29            client = backend()
30            try:
31                client.open(app)
32            except SessionError:
33                pass
34            else:
35                client.close()
36                client.close()
37