Exemple #1
0
    def __init__(self, prompt=":> ", quitChar='\\'):
        self.prompt = prompt
        self.quitChar = quitChar
        self.mainMenu = """   
        {}   Exit Prompt
        1   Create Contact
        2   Edit Contact
        3   Delete Contact
        4   Show Contact 
@Main{}""".format(quitChar, prompt)
        contactDb = ContactsDb('localhost', 'root', '1234', 'contacts_orm',
                               'contacts')
        Contact.connect(contactDb)
        pass
Exemple #2
0
 def setUp(self):
     cdb = ContactsDb(HOST, USERNAME, PASSWORD, DBNAME, TABLE)
     Contact.connect(cdb)
     testContact.save()
Exemple #3
0
 def testWrongPasswordForConnect(self):
     self.assertRaises(
         OperationalError,
         ContactsDb(HOST, USERNAME, 'wrongpassword', DBNAME, TABLE).connect)
Exemple #4
0
 def testDbConnect(self):
     self.assertTrue(
         ContactsDb(HOST, USERNAME, PASSWORD, DBNAME, TABLE).connect())
     pass