Esempio n. 1
0
 def test_singular_subresource_no_schema(self, mock_schema, mock_par):
     parent = Mock()
     mock_par.return_value = parent
     mock_schema.return_value = None
     assert not utils.singular_subresource('foo', 1)
     mock_par.assert_called_once_with('foo', method='POST')
     mock_schema.assert_called_once_with(parent)
Esempio n. 2
0
 def test_singular_subresource_not_attr(self, mock_schema, mock_par):
     parent = Mock()
     mock_par.return_value = parent
     mock_schema.return_value = {
         'properties': {
             'route_name': {
                 'type': 'string'
             }
         }
     }
     assert not utils.singular_subresource('resource', 'route_name')
     mock_par.assert_called_once_with('resource')
     mock_schema.assert_called_once_with(parent)
Esempio n. 3
0
 def test_singular_subresource_dict(self, mock_schema, mock_par):
     parent = Mock()
     mock_par.return_value = parent
     mock_schema.return_value = {
         'properties': {
             'route_name': {
                 'type': 'relationship',
                 'args': {'uselist': False}
             },
         }
     }
     assert utils.singular_subresource('resource', 'route_name')
     mock_par.assert_called_once_with('resource')
     mock_schema.assert_called_once_with(parent)
Esempio n. 4
0
 def test_singular_subresource_not_attr(self, mock_schema, mock_par):
     parent = Mock()
     mock_par.return_value = parent
     mock_schema.return_value = {
         'properties': {
             'route_name': {
                 '_db_settings': {
                     'type': 'string'
                 }
             }
         }
     }
     assert not utils.singular_subresource('resource', 'route_name')
     mock_par.assert_called_once_with('resource', method='POST')
     mock_schema.assert_called_once_with(parent)
Esempio n. 5
0
 def test_singular_subresource_dict(self, mock_schema, mock_par):
     parent = Mock()
     mock_par.return_value = parent
     mock_schema.return_value = {
         'properties': {
             'route_name': {
                 '_db_settings': {
                     'type': 'relationship',
                     'uselist': False
                 }
             },
         }
     }
     assert utils.singular_subresource('resource', 'route_name')
     mock_par.assert_called_once_with('resource', method='POST')
     mock_schema.assert_called_once_with(parent)
Esempio n. 6
0
 def test_singular_subresource_no_static_parent(self, mock_schema, mock_par):
     mock_par.return_value = None
     assert not utils.singular_subresource('foo', 1)
     mock_par.assert_called_once_with('foo')