Esempio n. 1
0
    def test_camelize(self):
        data = {'bandwidth_limit': 'BandwidthLimit',
                'test': 'Test',
                'some__more__dashes': 'SomeMoreDashes',
                'a_penguin_walks_into_a_bar': 'APenguinWalksIntoABar'}

        for s, expected in data.items():
            self.assertEqual(expected, utils.camelize(s))
Esempio n. 2
0
    def test_camelize(self):
        data = {'bandwidth_limit': 'BandwidthLimit',
                'test': 'Test',
                'some__more__dashes': 'SomeMoreDashes',
                'a_penguin_walks_into_a_bar': 'APenguinWalksIntoABar'}

        for s, expected in data.items():
            self.assertEqual(expected, utils.camelize(s))
Esempio n. 3
0
def get_rules(context, qos_policy_id):
    all_rules = []
    with db_api.autonested_transaction(context.session):
        for rule_type in qos_consts.VALID_RULE_TYPES:
            rule_cls_name = 'Qos%sRule' % utils.camelize(rule_type)
            rule_cls = getattr(sys.modules[__name__], rule_cls_name)

            rules = rule_cls.get_objects(context, qos_policy_id=qos_policy_id)
            all_rules.extend(rules)
    return all_rules
Esempio n. 4
0
    def test_camelize(self):
        data = {
            "bandwidth_limit": "BandwidthLimit",
            "test": "Test",
            "some__more__dashes": "SomeMoreDashes",
            "a_penguin_walks_into_a_bar": "APenguinWalksIntoABar",
        }

        for s, expected in data.items():
            self.assertEqual(expected, utils.camelize(s))
Esempio n. 5
0
def get_rules(context, qos_policy_id):
    all_rules = []
    with db_api.autonested_transaction(context.session):
        for rule_type in qos_consts.VALID_RULE_TYPES:
            rule_cls_name = 'Qos%sRule' % utils.camelize(rule_type)
            rule_cls = getattr(sys.modules[__name__], rule_cls_name)

            rules = rule_cls.get_objects(context, qos_policy_id=qos_policy_id)
            all_rules.extend(rules)
    return all_rules