Browse Source

Committed the test class for LeDataSourceSQL

Roland Haroutiounian 9 years ago
parent
commit
486213d06d
1 changed files with 22 additions and 0 deletions
  1. 22
    0
      leobject/test/test_ledatasourcesql.py

+ 22
- 0
leobject/test/test_ledatasourcesql.py View File

@@ -0,0 +1,22 @@
1
+# -*- coding: utf8 -*-
2
+
3
+import unittest
4
+import sqlite3
5
+from unittest import TestCase
6
+from leobject.datasources.ledatasourcesql import LeDataSourceSQL
7
+from mosql.db import Database
8
+
9
+
10
+class _LeDataSourceTestCase(TestCase):
11
+
12
+    def setUp(self):
13
+        self.mydatasource = LeDataSourceSQL(sqlite3, *{'db.sqlite3': '127.0.0.1'})
14
+
15
+    def tearDown(self):
16
+        del self.mydatasource
17
+
18
+    def test_connection(self):
19
+        """Tests if the connection occurs"""
20
+        self.assertIsInstance(obj=self.mydatasource, cls=LeDataSourceSQL, msg='A %s object was expected, %s obtained instead' % (LeDataSourceSQL.__class__, self.mydatasource.__class__))
21
+        self.assertIsNotNone(obj=self.mydatasource.connection, msg='The database connection cursor could not be instanciated')
22
+        self.assertIsInstance(self.mydatasource.connection, Database, msg='%s object was expected for the connection cursor, %s obtained instead' % (Database.__class__, self.mydatasource.connection.__class__))

Loading…
Cancel
Save