def test_add_config(config_file): name = "test-device" url = "https://localhost:2223" path = "/home/myself/cozyfiles" db_login = "******" db_password = "******" local_config.add_config(name, url, path, db_login, db_password) res = {"test-device": {"url": url, "path": path, "dblogin": db_login, "dbpassword": db_password}} assert res == local_config.get_full_config()
def test_add_config(config_file): name = 'test-device' url = 'https://localhost:2223' path = '/home/myself/cozyfiles' db_login = '******' db_password = '******' local_config.add_config(name, url, path, db_login, db_password) res = { 'test-device': { 'url': url, 'path': path, 'dblogin': db_login, 'dbpassword': db_password, } } assert res == local_config.get_full_config()
def start(): gettext.install("app") # replace with the appropriate catalog name app = wx.PySimpleApp(0) wx.InitAllImageHandlers() # Initialize dialog window and tray menu cozy_frame = CozyFrame(None, wx.ID_ANY, "") cozy_tray = CozyTray() # Get them know each other cozy_frame.SetMainTray(cozy_tray) cozy_tray.SetMainFrame(cozy_frame) # Set the dialog window as top window app.SetTopWindow(cozy_frame) # Set default values cozy_frame.text_device_name.SetValue(socket.gethostname().replace('.', '_').replace('-', '_').lower()) cozy_frame.text_sync_folder.SetValue('%s/cozy' % (os.path.expanduser("~"))) try: # Fetch configuration and select the first device config = get_full_config().itervalues().next() # Fill the dialog window with configuration values cozy_frame.text_cozy_password.SetValue('aaaaa') if 'dblogin' in config: cozy_frame.text_device_name.SetValue(config['dblogin']) if 'url' in config: cozy_frame.text_cozy_url.SetValue(config['url']) if 'path' in config: cozy_frame.text_sync_folder.SetValue(config['path']) # Indicate that Cozy is already configured to the dialog window if 'deviceid' in config: cozy_frame.SetConfigured(True) except NoConfigFile: # If no config file exists, show the dialog window cozy_frame.Show() app.MainLoop()
def test_get_full_config(config_file): config = local_config.get_full_config() assert {} == config
# Get them know each other cozy_frame.SetMainTray(cozy_tray) cozy_tray.SetMainFrame(cozy_frame) # Set the dialog window as top window app.SetTopWindow(cozy_frame) # Set default values cozy_frame.text_device_name.SetValue( socket.gethostname().replace('.', '_') ) cozy_frame.text_sync_folder.SetValue('%s/cozy' % (os.path.expanduser("~"))) try: # Fetch configuration and select the first device config = get_full_config().itervalues().next() # Fill the dialog window with configuration values cozy_frame.text_cozy_password.SetValue('aaaaa') if 'dblogin' in config: cozy_frame.text_device_name.SetValue(config['dblogin']) if 'url' in config: cozy_frame.text_cozy_url.SetValue(config['url']) if 'path' in config: cozy_frame.text_sync_folder.SetValue(config['path']) # Indicate that Cozy is already configured to the dialog window if 'deviceid' in config: cozy_frame.SetConfigured(True) except NoConfigFile: