def test_simple_default(self): question = mommy.make(Question) custom_field = easy.SimpleAdminField('not', default='default') ret = custom_field(question) self.assertEqual(ret, 'default') self.assertEqual(custom_field.short_description, 'not')
def test_simple_lambda(self): question = mommy.make(Question) custom_field = easy.SimpleAdminField(lambda obj: obj.poll, 'shorty') ret = custom_field(question) self.assertEqual(ret, question.poll) self.assertFalse(hasattr(custom_field, 'admin_order_field')) self.assertEqual(custom_field.short_description, 'shorty')
def test_simple(self): question = mommy.make(Question) custom_field = easy.SimpleAdminField('poll') ret = custom_field(question) self.assertEqual(ret, question.poll) self.assertEqual(custom_field.admin_order_field, 'poll') self.assertEqual(custom_field.short_description, 'poll')