def test_getuuid(self):
     self.assertIsNone(getuuid(None, None, None, None))
     uuid = str(uuid4())
     self.assertEqual(getuuid(uuid, None, None, None), uuid)
     uuid = uuid4()
     self.assertEqual(getuuid(uuid, None, None, None), str(uuid))
     self.assertEqual(getuuid(Foo, Foo.__tablename__, "id", None), Foo.id)
 def test_getuuid(self):
     self.assertIsNone(getuuid(None, None, None, None))
     uuid = str(uuid4())
     self.assertEqual(getuuid(uuid, None, None, None), uuid)
     uuid = uuid4()
     self.assertEqual(getuuid(uuid, None, None, None), str(uuid))
     self.assertEqual(getuuid(Foo, Foo.__tablename__, "id", None), Foo.id)
    def test_getuuid_error(self):
        with self.assertRaises(ValueError):
            getuuid("foo", None, None, None)

        # test a few values which should never return anything
        for unknown_value in (1, 1.25, lambda: None):
            with self.assertRaises(ValueError):
                getuuid(unknown_value, None, None, None)

        with self.assertRaises(ValueError):
            getuuid(Foo, Foo.__tablename__, "none", None)
    def test_getuuid_error(self):
        with self.assertRaises(ValueError):
            getuuid("foo", None, None, None)

        # test a few values which should never return anything
        for unknown_value in (1, 1.25, lambda: None):
            with self.assertRaises(ValueError):
                getuuid(unknown_value, None, None, None)

        with self.assertRaises(ValueError):
            getuuid(Foo, Foo.__tablename__, "none", None)