Improved MySQL unit test

diff -r ee096086cadd test/_common.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/_common.py	Wed Jul 04 10:01:09 2007 +0200
@@ -0,0 +1,7 @@
+testN3="""
+@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix : <http://test/> .
+{:a :b :c;a :foo} => {:a :d :c,?y}.
+_:foo a rdfs:Class.
+:a :d :c."""
diff -r ee096086cadd test/mysql.py
--- a/test/mysql.py	Wed Jul 04 09:59:12 2007 +0200
+++ b/test/mysql.py	Wed Jul 04 10:01:09 2007 +0200
@@ -1,3 +1,6 @@ from n3_2 import testN3Store,testN3,impl
+import unittest
+
+from rdflib.store.MySQL import MySQL
 from n3_2 import testN3Store,testN3,implies
 from rdflib.Graph import QuotedGraph
 try:
@@ -5,6 +8,9 @@ except ImportError, e:
 except ImportError, e:
     print "Can not test REGEX bits:", e
 from rdflib import *
+
+import _common
+
 configString="user=,password=,host=localhost,db=test"
 
 def testRegex():
@@ -90,9 +96,31 @@ def profileTests():
     s.print_callees(.1)
 
 profileTests.non_standard_dep = True
+ 
+class TestMySQL(unittest.TestCase):
+    def setUp(self):
+        store = MySQL()
+        store.open("user=,password=,db=test,host=localhost", create=True)
+        self.__graph = Graph(store)
+
+    def tearDown(self):
+        graph = self.__graph
+        graph.destroy("user=,password=,db=test,host=localhost")
+        graph.close()
+
+    def testCommit(self):
+        graph = self.__graph
+        graph.parse(StringInputSource(_common.testN3), format='n3')
+        graph.commit()
+
+        store = MySQL()
+        store.open("user=,password=,db=test,host=localhost")
+        otherGraph = Graph(store)
+        try: self.assertEqual(otherGraph, graph)
+        finally: otherGraph.close()
 
 if __name__=='__main__':
-    testN3Store('MySQL',configString)
-    testRegex()
-    #profileTests()
-
+#   testN3Store('MySQL',configString)
+#   testRegex()
+#   profileTests()
+    unittest.main()
