Пример #1
0
 def test_get_static_parent(self):
     resource = Mock()
     parent = Mock(
         resources={'/{id}': resource},
         parentResource=Mock(resources=None))
     resource.parentResource = parent
     assert utils.get_static_parent(resource) is parent
Пример #2
0
 def test_get_static_parent_nested(self):
     resource = Mock()
     parent2 = Mock(
         parentResource=Mock(resources=None))
     parent = Mock(
         resources={'/{id}': resource},
         parentResource=parent2)
     parent2.resources = {'/{id}': parent}
     resource.parentResource = parent
     assert utils.get_static_parent(resource) is parent2
Пример #3
0
 def test_is_dynamic_resource_not_dynamic(self):
     resource = Mock()
     parent = Mock(resources={'/items': resource})
     resource.parentResource = parent
     assert not utils.is_dynamic_resource(resource)
Пример #4
0
 def test_is_dynamic_resource_no_resources(self):
     resource = Mock()
     parent = Mock(resources=None)
     resource.parentResource = parent
     assert not utils.is_dynamic_resource(resource)
Пример #5
0
 def test_is_dynamic_resource(self):
     resource = Mock()
     parent = Mock(resources={'/{id}': resource})
     resource.parentResource = parent
     assert utils.is_dynamic_resource(resource)