コード例 #1
0
ファイル: console.py プロジェクト: jherrlin/unipass
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+'|')        
コード例 #2
0
ファイル: test_controller.py プロジェクト: jherrlin/unipass
 def test_deleteEntry_True(self):
     self.assertTrue(controller.add_service('facebook', '*****@*****.**', 'password', 'facebook acc'))
     serv = controller.find_by_service('facebook')
     self.assertTrue(controller.delete_service(serv.uuid))