Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
scripts.database_test.DatabaseTestCase Class Reference
Inheritance diagram for scripts.database_test.DatabaseTestCase:

Public Member Functions

def setUp (self)
 
def tearDown (self)
 
def testCreate (self)
 
def testListInterfaces (self)
 
def testHasInterface (self)
 
def testAddInterface (self)
 
def testDeleteInterface (self)
 
def testGetInterface (self)
 

Detailed Description

Definition at line 17 of file database_test.py.

Member Function Documentation

◆ setUp()

def scripts.database_test.DatabaseTestCase.setUp (   self)

Definition at line 30 of file database_test.py.

30 def setUp(self):
31 self._idl_parser = idlparser.IDLParser(idlparser.FREMONTCUT_SYNTAX)
32
33 working_dir = tempfile.mkdtemp()
34 self._database_dir = os.path.join(working_dir, 'database')
35 self.assertFalse(os.path.exists(self._database_dir))
36
37 # Create database and add one interface.
38 db = database.Database(self._database_dir)
39 interface = self._ParseInterface('interface I1 {};')
40 db.AddInterface(interface)
41 db.Save()
42 self.assertTrue(
43 os.path.exists(os.path.join(self._database_dir, 'I1.idl')))
44

◆ tearDown()

def scripts.database_test.DatabaseTestCase.tearDown (   self)

Definition at line 45 of file database_test.py.

45 def tearDown(self):
46 shutil.rmtree(self._database_dir)
47

◆ testAddInterface()

def scripts.database_test.DatabaseTestCase.testAddInterface (   self)

Definition at line 62 of file database_test.py.

62 def testAddInterface(self):
63 db = database.Database(self._database_dir)
64 db.Load()
65 interface = self._ParseInterface('interface I2 {};')
66 db.AddInterface(interface)
67 db.Save()
68 self.assertTrue(
69 os.path.exists(os.path.join(self._database_dir, 'I2.idl')))
70 self.assertEqual(self._ListInterfaces(db), ['I1', 'I2'])
71

◆ testCreate()

def scripts.database_test.DatabaseTestCase.testCreate (   self)

Definition at line 48 of file database_test.py.

48 def testCreate(self):
49 self.assertTrue(os.path.exists(self._database_dir))
50

◆ testDeleteInterface()

def scripts.database_test.DatabaseTestCase.testDeleteInterface (   self)

Definition at line 72 of file database_test.py.

72 def testDeleteInterface(self):
73 db = database.Database(self._database_dir)
74 db.Load()
75 db.DeleteInterface('I1')
76 db.Save()
77 self.assertFalse(
78 os.path.exists(os.path.join(self._database_dir, 'I1.idl')))
79 self.assertEqual(self._ListInterfaces(db), [])
80

◆ testGetInterface()

def scripts.database_test.DatabaseTestCase.testGetInterface (   self)

Definition at line 81 of file database_test.py.

81 def testGetInterface(self):
82 db = database.Database(self._database_dir)
83 db.Load()
84 interface = db.GetInterface('I1')
85 self.assertEqual(interface.id, 'I1')
86
87

◆ testHasInterface()

def scripts.database_test.DatabaseTestCase.testHasInterface (   self)

Definition at line 56 of file database_test.py.

56 def testHasInterface(self):
57 db = database.Database(self._database_dir)
58 db.Load()
59 self.assertTrue(db.HasInterface('I1'))
60 self.assertFalse(db.HasInterface('I2'))
61

◆ testListInterfaces()

def scripts.database_test.DatabaseTestCase.testListInterfaces (   self)

Definition at line 51 of file database_test.py.

51 def testListInterfaces(self):
52 db = database.Database(self._database_dir)
53 db.Load()
54 self.assertEqual(self._ListInterfaces(db), ['I1'])
55

The documentation for this class was generated from the following file: