Esempio n. 1
0
    def test_camel_to_snake__complex(self):
        input_str = 'foo1Bar2__abcDef'
        expected = 'foo1_bar2__abc_def'

        result = utils.camel_to_snake(input_str)

        self.assertEqual(expected, result)
Esempio n. 2
0
    def test_camel_to_snake__pascal(self):
        input_str = 'FooBar'
        expected = 'foo_bar'

        result = utils.camel_to_snake(input_str)

        self.assertEqual(expected, result)
Esempio n. 3
0
    def hydrate(self, describe_platform_version):
        """
        Given a function the takes a platform version arn as input and returns
        a platform version description, will populate the class instance
        properties with the values from the platform version description.

        Will only run once.
        """
        if not self._is_hydrated():
            platform_version_description = describe_platform_version(
                self.platform_arn)

            platform_version_description = utils.pick(
                platform_version_description, PlatformVersion.API_KEYS)

            for key in platform_version_description:
                attr = utils.camel_to_snake(key)
                setattr(self, attr, platform_version_description[key])

            self.__hydrate_ran = True

        return self
Esempio n. 4
0
    def hydrate(self, get_platform_branch_by_name):
        """
        Given a function the takes a platform branch name as input and
        returns a platform branch summary, will populate the class
        instance properties with the values from the
        platform branch summary.

        Will only run once.
        """
        if not self._is_hydrated():
            platform_branch_summary = get_platform_branch_by_name(
                self.branch_name)

            platform_branch_summary = utils.pick(platform_branch_summary,
                                                 PlatformBranch.API_KEYS)

            for key in platform_branch_summary:
                attr = utils.camel_to_snake(key)
                setattr(self, attr, platform_branch_summary[key])

            self.__hydrate_ran = True

        return self