Exemplo n.º 1
0
 def test_default(self):
     """
     should return target class's primary key if no primary_key was passed
     as a kwarg
     """
     association = Association(target_klass=TargetModel, id='whatever')
     self.assertEqual(TargetModel.primary_key(), association.primary_key())
Exemplo n.º 2
0
 def setUp(self):
     self.klass = fixtures.association_models.Test
     self.id = 'associations'
     self.args = { 'foo': 'bar' }
     self.primary_key = 'primary_key'
     self.foreign_key = 'foreign_key'
     self.source_class = fixtures.association_models.Source
     self.association = Association(**self.args)
     self.association.target_klass = self.klass
     self.association.id = self.id
Exemplo n.º 3
0
 def test_eager_loadable_lambda(self):
     """should return false if a block is used for the param of
     any finder option"""
     for option in finder_options:
         self.assertEqual(False, Association(
             target_klass=self.klass,
             id=self.id,
             **{
                 option: lambda x: {}
             }
         ).eager_loadable())