A bunch of simple OpenSSL.rand tests
diff --git a/OpenSSL/test/test_rand.py b/OpenSSL/test/test_rand.py
index 05bf8c8..ecc5b97 100644
--- a/OpenSSL/test/test_rand.py
+++ b/OpenSSL/test/test_rand.py
@@ -29,6 +29,17 @@
         self.assertEqual(str(exc), "num_bytes must not be negative")
 
 
+    def test_add_wrong_args(self):
+        """
+        When called with the wrong number of arguments, or with arguments not of
+        type C{str} and C{int}, L{OpenSSL.rand.add} raises L{TypeError}.
+        """
+        self.assertRaises(TypeError, rand.add)
+        self.assertRaises(TypeError, rand.add, "foo", None)
+        self.assertRaises(TypeError, rand.add, None, 3)
+        self.assertRaises(TypeError, rand.add, "foo", 3, None)
+
+
     def test_add(self):
         """
         L{OpenSSL.rand.add} adds entropy to the PRNG.
@@ -36,6 +47,16 @@
         rand.add('hamburger', 3)
 
 
+    def test_seed_wrong_args(self):
+        """
+        When called with the wrong number of arguments, or with a non-C{str}
+        argument, L{OpenSSL.rand.seed} raises L{TypeError}.
+        """
+        self.assertRaises(TypeError, rand.seed)
+        self.assertRaises(TypeError, rand.seed, None)
+        self.assertRaises(TypeError, rand.seed, "foo", None)
+
+
     def test_seed(self):
         """
         L{OpenSSL.rand.seed} adds entropy to the PRNG.
@@ -43,6 +64,14 @@
         rand.seed('milk shake')
 
 
+    def test_status_wrong_args(self):
+        """
+        L{OpenSSL.rand.status} raises L{TypeError} when called with any
+        arguments.
+        """
+        self.assertRaises(TypeError, rand.status, None)
+
+
     def test_status(self):
         """
         L{OpenSSL.rand.status} returns C{True} if the PRNG has sufficient
@@ -54,11 +83,68 @@
         self.assertTrue(rand.status() in (1, 2))
 
 
+    def test_egd_wrong_args(self):
+        """
+        L{OpenSSL.rand.egd} raises L{TypeError} when called with the wrong
+        number of arguments or with arguments not of type C{str} and C{int}.
+        """
+        self.assertRaises(TypeError, rand.egd)
+        self.assertRaises(TypeError, rand.egd, None)
+        self.assertRaises(TypeError, rand.egd, "foo", None)
+        self.assertRaises(TypeError, rand.egd, None, 3)
+        self.assertRaises(TypeError, rand.egd, "foo", 3, None)
+
+
+    def test_egd_missing(self):
+        """
+        L{OpenSSL.rand.egd} returns C{0} if the EGD socket passed to it does not
+        exist.
+        """
+        self.assertEquals(rand.egd(self.mktemp()), 0)
+
+
+    def test_cleanup_wrong_args(self):
+        """
+        L{OpenSSL.rand.cleanup} raises L{TypeError} when called with any
+        arguments.
+        """
+        self.assertRaises(TypeError, rand.cleanup, None)
+
+
+    def test_cleanup(self):
+        """
+        L{OpenSSL.rand.cleanup} releases the memory used by the PRNG and returns
+        C{None}.
+        """
+        self.assertIdentical(rand.cleanup(), None)
+
+
+    def test_load_file_wrong_args(self):
+        """
+        L{OpenSSL.rand.load_file} raises L{TypeError} when called the wrong
+        number of arguments or arguments not of type C{str} and C{int}.
+        """
+        self.assertRaises(TypeError, rand.load_file)
+        self.assertRaises(TypeError, rand.load_file, "foo", None)
+        self.assertRaises(TypeError, rand.load_file, None, 1)
+        self.assertRaises(TypeError, rand.load_file, "foo", 1, None)
+
+
+    def test_write_file_wrong_args(self):
+        """
+        L{OpenSSL.rand.write_file} raises L{TypeError} when called with the
+        wrong number of arguments or a non-C{str} argument.
+        """
+        self.assertRaises(TypeError, rand.write_file)
+        self.assertRaises(TypeError, rand.write_file, None)
+        self.assertRaises(TypeError, rand.write_file, "foo", None)
+
+
     def test_files(self):
         """
         Test reading and writing of files via rand functions.
         """
-        # Write random bytes to a file 
+        # Write random bytes to a file
         tmpfile = self.mktemp()
         # Make sure it exists (so cleanup definitely succeeds)
         fObj = file(tmpfile, 'w')
@@ -68,7 +154,7 @@
             # Verify length of written file
             size = os.stat(tmpfile)[stat.ST_SIZE]
             self.assertEquals(size, 1024)
-            # Read random bytes from file 
+            # Read random bytes from file
             rand.load_file(tmpfile)
             rand.load_file(tmpfile, 4)  # specify a length
         finally: