Exemple #1
0
def start(urwid, add, get, list, export_data, import_data):

    if import_data is not None:
        if controller.import_data(import_data):
            print('Import successful')
        else:
            print('Somethings wrong!')

    if export_data is not None:
        if controller.export_data(export_data):
            print('Export successful!')
        else:
            print('Somethings wrong!')

    if initdb() is not True:
        create_user()
        print('User created!')

    if urwid:
        print('Login!')
        username = str(input('User: '******'Pass: '******'User:'******'Pass: '******'Service: {}'.format(result.service))
                print('User: {}'.format(result.name))
                print('Password: {}'.format(result.password))
                print('Note: {}'.format(result.note))
            else:
                print('could not find service')
        else:
            print('wrong cridentials')

    if add:
        service = str(input('Service: '))
        username = str(input('Username: '******'Password: '******'Note: '))
        if controller.add_service(service, username, password, note):
            print('{} saved.'.format(service))
        else:
            print('Something when wrong, sorry')

    if list:
        print('|'+'-'*55+'|')        
        print('| {:>25} | {:25} |'.format('Service', 'Username'))
        print('|'+'-'*55+'|')
        for service in controller.list_all_services():
            print('| {:>25} | {:25} |'.format(service[0], service[1]))
        print('|'+'-'*55+'|')        
Exemple #2
0
 def test_exportData_True(self):
     self.assertTrue(controller.create_user('john', 'password'))
     self.assertTrue(controller.export_data())
Exemple #3
0
 def test_exportData_False(self):
     self.assertTrue(controller.export_data())
Exemple #4
0
 def save(btn):
     controller.export_data(path.get_edit_text())
     status.set_text('\nUpdated success!')