1# This Source Code Form is subject to the terms of the Mozilla Public
2# License, v. 2.0. If a copy of the MPL was not distributed with this
3# file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5from marionette_driver.geckoinstance import apps, GeckoInstance
6
7from marionette_harness import MarionetteTestCase
8
9
10class TestGeckoInstance(MarionetteTestCase):
11
12    def test_create(self):
13        """Test that the correct gecko instance is determined."""
14        for app in apps:
15            # If app has been specified we directly return the appropriate instance class
16            self.assertEqual(type(GeckoInstance.create(app=app, bin="n/a")),
17                             apps[app])
18
19        # Unknown applications and binaries should fail
20        self.assertRaises(NotImplementedError, GeckoInstance.create,
21                          app="n/a", bin=self.marionette.bin)
22        self.assertRaises(NotImplementedError, GeckoInstance.create,
23                          bin="n/a")
24        self.assertRaises(NotImplementedError, GeckoInstance.create,
25                          bin=None)
26