~daniel-nichter/boots/vertical-output

« back to all changes in this revision

Viewing changes to tests/boots/boots_unit_test.py

  • Committer: Max Goodman
  • Date: 2010-03-29 23:47:14 UTC
  • Revision ID: chromakode@gmail.com-20100329234714-e6jy51kq2j79ev3i
Fix up unit tests, handle warnings in api.Server objects, and add --quiet option to suppress warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
import os.path
30
30
from subprocess import Popen, PIPE
31
31
 
 
32
from boots.api import errors, api
 
33
 
32
34
class BootsBaseTester(unittest.TestCase):
33
35
    """Simple unit test test case class that includes a boots testing config.
34
36
 
35
37
    All boots unit test classes should inherit from this class or one of its
36
38
    children."""
37
39
    config = {"host": "localhost",
38
 
              "port": 9306,
 
40
              "port": 3306,
39
41
              "database": "boots_fec_test"}
 
42
    
 
43
    def connect(self):
 
44
        server = api.DrizzleServer(self.config["host"], self.config["port"], self.config["database"],
 
45
                                   {"username": self.config["username"], "password": self.config["password"]})
 
46
        server.connect()
 
47
        return server
40
48
 
41
49
class BootsQueryTester(BootsBaseTester):
42
50
    """Unit test class that includes a setUp method that can be used to load
59
67
        fec_sql_path = os.path.join(base_tests_path, "fec.sql")
60
68
        boots_path = os.path.join(base_tests_path, "../../bin/boots")
61
69
        
62
 
        cmd = "{boots} -H {host} -p {port} -f {file}".format(boots=boots_path,
63
 
                                                             file=fec_sql_path, 
64
 
                                                             **self.config)
 
70
        cmd = "{boots} -h {host} -p {port} -u {username} -P {password} -f {file} --quiet"\
 
71
              .format(boots=boots_path, file=fec_sql_path, **self.config)
65
72
        p = Popen(cmd, shell=True)
66
73
        p.communicate()
 
74
        
 
75
        self.server = self.connect()