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 __future__ import absolute_import 6 7from marionette_driver.geckoinstance import apps, GeckoInstance 8 9from marionette_harness import MarionetteTestCase 10 11 12class TestGeckoInstance(MarionetteTestCase): 13 14 def test_create(self): 15 """Test that the correct gecko instance is determined.""" 16 for app in apps: 17 # If app has been specified we directly return the appropriate instance class 18 self.assertEqual(type(GeckoInstance.create(app=app, bin="n/a")), 19 apps[app]) 20 21 # Unknown applications and binaries should fail 22 self.assertRaises(NotImplementedError, GeckoInstance.create, 23 app="n/a", bin=self.marionette.bin) 24 self.assertRaises(NotImplementedError, GeckoInstance.create, 25 bin="n/a") 26 self.assertRaises(NotImplementedError, GeckoInstance.create, 27 bin=None) 28