Пример #1
0
    def test_restrictions_grouped_allowed(self):

        attributes = {'test': 'value'}

        restrictions = {'test': ['#owner']}

        _apply_restrictions(attributes, restrictions, None, [], [],
                            {'owner': ['abcd']}, 'abcd')

        self.assertIsNotNone(attributes.get('test'))
Пример #2
0
    def test_restrictions_specific_removed(self):

        attributes = {'test': 'value'}

        restrictions = {'test': ['$owner']}

        _apply_restrictions(attributes, restrictions, None, [], [],
                            {'owner': 'abc'}, 'abcd')

        self.assertIsNone(attributes.get('test'))
Пример #3
0
    def test_restrictions_nested_removed(self):

        attributes = {'test': {'ing': 'value'}}

        restrictions = {'test': {'ing': ['group']}}

        groups = []

        _apply_restrictions(attributes, restrictions, groups, [], [], None, '')

        self.assertIsNone(attributes.get('test'))
Пример #4
0
    def test_restrictions_group_allowed(self):

        attributes = {'test': 'ing'}

        restrictions = {'test': ['group']}

        groups = ['group']

        _apply_restrictions(attributes, restrictions, groups, [], [], None, '')

        self.assertIsNotNone(attributes.get('test'))
Пример #5
0
    def test_restrictions_grouped_nested_removed(self):

        attributes = {'test': 'value'}

        restrictions = {'test': ['#owner.id']}

        _apply_restrictions(attributes, restrictions, None, [], [],
                            {'owner': {
                                'id': ['abc']
                            }}, 'abcd')

        self.assertIsNone(attributes.get('test'))
Пример #6
0
    def test_restrictions_specific_nested_allowed(self):

        attributes = {'test': 'value'}

        restrictions = {'test': ['$owner.id']}

        _apply_restrictions(attributes, restrictions, None, [], [],
                            {'owner': {
                                'id': 'abcd'
                            }}, 'abcd')

        self.assertIsNotNone(attributes.get('test'))