Exemple #1
0
    def test_init_locators(self):
        """Verify that locators are initialized if not passed in"""
        with mock.patch.object(Salesforce, "_init_locators"):
            # _init_locators should NOT be called if we pass them in
            sflib = Salesforce(locators={"body": "//whatever"})
            assert not sflib._init_locators.called

            # _init_locators SHOULD be called if we don't pass them in
            sflib = Salesforce()
            sflib._init_locators.assert_called_once()
    def test_locators_outside_robot_context(self, builtin_mock):
        """Verify that we get the latest locators if not running in the context of a robot test"""

        # This instantiates the robot library, mimicing a robot library import
        # however, because we've mocked get_library_instance to throw an error,
        # we expect the library to still be instantiated, but with the latest
        # version of the locators.
        sf = Salesforce()
        expected = "cumulusci.robotframework.locators_48"
        actual = sf.locators_module.__name__
        message = "expected to load '{}', actually loaded '{}'".format(
            expected, actual)
        self.assertEqual(expected, actual, message)
    def test_locators_in_robot_context(self, get_latest_api_version):
        """Verify we can get locators for the current org api version"""
        get_latest_api_version.return_value = 45.0

        # This instantiates the robot library, mimicking a robot library import.
        # We've mocked out the code that would otherwise throw an error since
        # we're not running in the context of a robot test. The library should
        # return the latest version of the locators.
        sf = Salesforce()

        expected = "cumulusci.robotframework.locators_45"
        actual = sf.locators_module.__name__
        message = "expected to load '{}', actually loaded '{}'".format(
            expected, actual)
        self.assertEqual(expected, actual, message)

        pass
Exemple #4
0
 def setUpClass(cls):
     super(TestKeyword_breakpoint, cls).setUpClass()
     cls.sflib = Salesforce(locators={"body": "//whatever"})
Exemple #5
0
 def setUpClass(cls):
     super(TestKeyword_wait_until_salesforce_is_ready, cls).setUpClass()
     cls.sflib = Salesforce(locators={"body": "//whatever"})