|
9 | 9 |
|
10 | 10 | import unittest |
11 | 11 | import decimal |
| 12 | +import platform |
12 | 13 | import time |
13 | 14 | import os |
14 | 15 | import sys |
|
17 | 18 | from .nuodb_base import NuoBase |
18 | 19 | from .mock_tzs import EscapingTimestamp |
19 | 20 | from .mock_tzs import Local |
20 | | -from pynuodb.exception import DataError |
| 21 | +from pynuodb.exception import DataError, ProgrammingError |
21 | 22 |
|
22 | 23 |
|
23 | 24 | class NuoDBBasicTest(NuoBase): |
@@ -457,6 +458,36 @@ def test_long_string_types(self): |
457 | 458 | finally: |
458 | 459 | con.close() |
459 | 460 |
|
| 461 | + def test_connection_properties(self): |
| 462 | + #Get NuoDB release |
| 463 | + con = self._connect() |
| 464 | + cursor = con.cursor() |
| 465 | + try: |
| 466 | + cursor.execute("select getReleaseversion() from dual") |
| 467 | + except ProgrammingError as pe: |
| 468 | + return #2.0 or earlier, skip test |
| 469 | + |
| 470 | + version = cursor.fetchone()[0] |
| 471 | + majorVersion = version[0] |
| 472 | + minorVersion = version[2] |
| 473 | + if(majorVersion is '2'): |
| 474 | + if(minorVersion is not '3'): |
| 475 | + return |
| 476 | + |
| 477 | + clientInfo = "NuoDB Python driver" |
| 478 | + tmp_args = self.connect_kw_args.copy() |
| 479 | + tmp_args['options'] = {'schema': 'test', 'clientInfo': clientInfo} |
| 480 | + con = pynuodb.connect(**tmp_args)#self._connect({'clientInfo':'Hello World'}) |
| 481 | + cursor = con.cursor() |
| 482 | + cursor.execute("select * from SYSTEM.CONNECTIONS") |
| 483 | + result = cursor.fetchone() |
| 484 | + |
| 485 | + #Make sure our clientHost, clientProcessId and clientInfo remain the same in the SYSTEM.CONNECTIONS table |
| 486 | + self.assertEqual(platform.node(), result[17]) #ClientHost |
| 487 | + self.assertEqual(str(os.getpid()), result[18]) #clientProcessId |
| 488 | + self.assertEqual(clientInfo, result[19]) #clientInfo |
| 489 | + |
| 490 | + |
460 | 491 | def test_utf8_string_types(self): |
461 | 492 | con = self._connect() |
462 | 493 | cursor = con.cursor() |
|
0 commit comments