Ejemplo n.º 1
0
 def test_can_write_attributes_to_connection(self):
     conn = Connection(self.connection)
     conn.dbname = 'BubblesInMyDrink'
     conn.server = 'mssql2014.test.tsi.lan'
     conn.username = '******'
     self.assertEqual(conn.dbname, 'BubblesInMyDrink')
     self.assertEqual(conn.username, 'bob')
     self.assertEqual(conn.server, 'mssql2014.test.tsi.lan')
Ejemplo n.º 2
0
 def test_can_write_attributes_to_connection(self):
     conn = Connection(self.connection)
     conn.dbname = 'BubblesInMyDrink'
     conn.server = 'mssql2014.test.tsi.lan'
     conn.username = '******'
     self.assertEqual(conn.dbname, 'BubblesInMyDrink')
     self.assertEqual(conn.username, 'bob')
     self.assertEqual(conn.server, 'mssql2014.test.tsi.lan')
Ejemplo n.º 3
0
 def test_can_write_attributes_to_connection(self):
     conn = Connection(self.connection)
     conn.dbname = 'BubblesInMyDrink'
     conn.server = 'mssql2014'
     conn.username = '******'
     conn.port = '1337'
     self.assertEqual(conn.dbname, 'BubblesInMyDrink')
     self.assertEqual(conn.username, 'bob')
     self.assertEqual(conn.server, 'mssql2014')
     self.assertEqual(conn.port, '1337')
Ejemplo n.º 4
0
    def test_can_create_datasource_from_connections(self):
        conn1 = Connection.from_attributes(
            server='a', dbname='b', username='******', dbclass='mysql', authentication='d')
        conn2 = Connection.from_attributes(
            server='1', dbname='2', username='******', dbclass='mysql', port='1337', authentication='7')
        ds = Datasource.from_connections('test', connections=[conn1, conn2])

        self.assertEqual(ds.connections[0].server, 'a')
        self.assertEqual(ds.connections[0].port, None)
        self.assertEqual(ds.connections[1].server, '1')
        self.assertEqual(ds.connections[1].port, '1337')
Ejemplo n.º 5
0
    def test_can_create_datasource_from_connections(self):
        conn1 = Connection.from_attributes(server='a',
                                           dbname='b',
                                           username='******',
                                           dbclass='mysql',
                                           authentication='d')
        conn2 = Connection.from_attributes(server='1',
                                           dbname='2',
                                           username='******',
                                           dbclass='mysql',
                                           authentication='7')
        ds = Datasource.from_connections('test', connections=[conn1, conn2])

        self.assertEqual(ds.connections[0].server, 'a')
        self.assertEqual(ds.connections[1].server, '1')
Ejemplo n.º 6
0
 def test_can_read_attributes_from_connection(self):
     conn = Connection(self.connection)
     self.assertEqual(conn.dbname, 'TestV1')
     self.assertEqual(conn.username, '')
     self.assertEqual(conn.server, 'mssql2012.test.tsi.lan')
     self.assertEqual(conn.dbclass, 'sqlserver')
     self.assertEqual(conn.authentication, 'sspi')
Ejemplo n.º 7
0
 def test_can_create_connection_from_scratch(self):
     conn = Connection.from_attributes(
         server='a', dbname='b', username='******', dbclass='mysql', authentication='d')
     self.assertEqual(conn.server, 'a')
     self.assertEqual(conn.dbname, 'b')
     self.assertEqual(conn.username, 'c')
     self.assertEqual(conn.dbclass, 'mysql')
     self.assertEqual(conn.authentication, 'd')
 def test_can_read_attributes_from_connection(self):
     conn = Connection(self.connection)
     self.assertEqual(conn.dbname, 'TestV1')
     self.assertEqual(conn.username, '')
     self.assertEqual(conn.server, 'mssql2012')
     self.assertEqual(conn.dbclass, 'sqlserver')
     self.assertEqual(conn.authentication, 'sspi')
     self.assertEqual(conn.port, '1433')
     self.assertEqual(conn.initial_sql, '')
     self.assertEqual(conn.query_band, '')
 def test_can_create_connection_from_scratch(self):
     conn = Connection.from_attributes(server='a',
                                       dbname='b',
                                       username='******',
                                       dbclass='mysql',
                                       authentication='d')
     self.assertEqual(conn.server, 'a')
     self.assertEqual(conn.dbname, 'b')
     self.assertEqual(conn.username, 'c')
     self.assertEqual(conn.dbclass, 'mysql')
     self.assertEqual(conn.authentication, 'd')
 def test_can_write_attributes_to_connection(self):
     conn = Connection(self.connection)
     conn.dbname = 'BubblesInMyDrink'
     conn.server = 'mssql2014'
     conn.username = '******'
     conn.port = '1337'
     conn.initial_sql = "insert values (1, 'winning') into schema.table"
     conn.query_band = 'TableauReport=<workbookname>'
     self.assertEqual(conn.dbname, 'BubblesInMyDrink')
     self.assertEqual(conn.username, 'bob')
     self.assertEqual(conn.server, 'mssql2014')
     self.assertEqual(conn.port, '1337')
     self.assertEqual(conn.initial_sql,
                      "insert values (1, 'winning') into schema.table")
     self.assertEqual(conn.query_band, 'TableauReport=<workbookname>')
Ejemplo n.º 11
0
 def test_can_write_attributes_to_connection(self):
     conn = Connection(self.connection)
     conn.dbname = 'BubblesInMyDrink'
     conn.server = 'mssql2014'
     conn.username = '******'
     conn.port = '1337'
     self.assertEqual(conn.dbname, 'BubblesInMyDrink')
     self.assertEqual(conn.username, 'bob')
     self.assertEqual(conn.server, 'mssql2014')
     self.assertEqual(conn.port, '1337')
Ejemplo n.º 12
0
 def test_can_write_attributes_to_connection(self):
     conn = Connection(self.connection)
     conn.dbname = 'BubblesInMyDrink'
     conn.server = 'mssql2014'
     conn.username = '******'
     conn.port = '1337'
     conn.initial_sql = "insert values (1, 'winning') into schema.table"
     conn.query_band = 'TableauReport=<workbookname>'
     self.assertEqual(conn.dbname, 'BubblesInMyDrink')
     self.assertEqual(conn.username, 'bob')
     self.assertEqual(conn.server, 'mssql2014')
     self.assertEqual(conn.port, '1337')
     self.assertEqual(conn.initial_sql, "insert values (1, 'winning') into schema.table")
     self.assertEqual(conn.query_band, 'TableauReport=<workbookname>')
Ejemplo n.º 13
0
 def test_can_delete_initial_sql_from_connection(self):
     conn = Connection(self.connection)
     conn.initial_sql = None
     self.assertEqual(conn.initial_sql, None)
     self.assertIsNone(conn._connectionXML.get('initial_sql'))
 def test_bad_dbclass_rasies_attribute_error(self):
     conn = Connection(self.connection)
     conn.dbclass = 'sqlserver'
     self.assertEqual(conn.dbclass, 'sqlserver')
     with self.assertRaises(AttributeError):
         conn.dbclass = 'NotReal'
 def test_can_delete_query_band_from_connection(self):
     conn = Connection(self.connection)
     conn.query_band = None
     self.assertEqual(conn.query_band, None)
     self.assertIsNone(conn._connectionXML.get('query_band'))
 def test_can_delete_initial_sql_from_connection(self):
     conn = Connection(self.connection)
     conn.initial_sql = None
     self.assertEqual(conn.initial_sql, None)
     self.assertIsNone(conn._connectionXML.get('initial_sql'))
 def test_can_delete_port_from_connection(self):
     conn = Connection(self.connection)
     conn.port = None
     self.assertEqual(conn.port, None)
     self.assertIsNone(conn._connectionXML.get('port'))
Ejemplo n.º 18
0
 def test_can_delete_port_from_connection(self):
     conn = Connection(self.connection)
     conn.port = None
     self.assertEqual(conn.port, None)
     self.assertIsNone(conn._connectionXML.get('port'))
Ejemplo n.º 19
0
 def test_can_delete_query_band_from_connection(self):
     conn = Connection(self.connection)
     conn.query_band = None
     self.assertEqual(conn.query_band, None)
     self.assertIsNone(conn._connectionXML.get('query_band'))
Ejemplo n.º 20
0
 def test_bad_dbclass_rasies_attribute_error(self):
     conn = Connection(self.connection)
     conn.dbclass = 'sqlserver'
     self.assertEqual(conn.dbclass, 'sqlserver')
     with self.assertRaises(AttributeError):
         conn.dbclass = 'NotReal'