Ejemplo n.º 1
0
class testNullableForeignKeyWidget(TestCase):
    def setUp(self):
        self.record = Partner(name="test partner")
        self.record.save()

    def test_valid_value(self):
        widget = NullableForeignKeyWidget(Partner, "name")
        self.assertEqual(widget.clean("test partner").id, self.record.id)

    def test_invalid_value(self):
        widget = NullableForeignKeyWidget(Partner, "name")
        self.assertEqual(widget.clean("unknown partner"), None)

    def tearDown(self):
        self.record.delete()
class testNullableForeignKeyWidget(TestCase):

    def setUp(self):
        self.record = Partner(name="test partner")
        self.record.save()

    def test_valid_value(self):
        widget = NullableForeignKeyWidget(Partner, "name")
        self.assertEqual(widget.clean("test partner").id, self.record.id)

    def test_invalid_value(self):
        widget = NullableForeignKeyWidget(Partner, "name")
        self.assertEqual(widget.clean("unknown partner"), None)

    def tearDown(self):
        self.record.delete()
Ejemplo n.º 3
0
 def setUp(self):
     self.record = Partner(name="test partner")
     self.record.save()
 def setUp(self):
     self.record = Partner(name="test partner")
     self.record.save()