def _fetch_updated_config(oauth, meta, builder, info): config = get_profile_config(oauth, meta.api_base_uri, meta.profile_id) meta.config = config config_dict = parse_ovpn(meta.config) update_config_provider(meta, config_dict) _2fa_check(meta, builder, oauth, config_dict, info)
def activate_connection(meta, builder): """do the actual connecting action""" logger.info("Connecting to {}".format(meta.display_name)) notify("eduVPN connecting...", "Connecting to '{}'".format(meta.display_name)) try: if not meta.token: logger.error("metadata for {} doesn't contain oauth2 token".format(meta.uuid)) else: oauth = oauth_from_token(meta=meta) config = get_profile_config(oauth, meta.api_base_uri, meta.profile_id) meta.config = config update_config_provider(meta) if datetime.now() > datetime.fromtimestamp(meta.token['expires_at']): logger.info("key pair is expired") cert, key = create_keypair(oauth, meta.api_base_uri) update_keys_provider(meta.uuid, cert, key) connect_provider(meta.uuid) except Exception as e: switch = builder.get_object('connect-switch') GLib.idle_add(switch.set_active, False) window = builder.get_object('eduvpn-window') error_helper(window, "can't enable connection", "{}: {}".format(type(e).__name__, str(e))) raise
def _fetch_updated_config(oauth, meta, builder, info, lets_connect): # type: (str, Metadata, Gtk.builder, dict, bool) -> None config = get_profile_config(oauth, meta.api_base_uri, meta.profile_id) meta.config = config config_dict = parse_ovpn(meta.config) update_config_provider(meta, config_dict) _2fa_check(meta, builder, oauth, config_dict, info, lets_connect)
def _fetch_updated_config(oauth, meta, builder, info): # type : (oauth, Metadata, verifier, Gtk.Builder ) -> None config = get_profile_config(oauth, meta.api_base_uri, meta.profile_id) meta.config = config config_dict = parse_ovpn(meta.config) update_config_provider(meta, config_dict) _2fa_check(meta, builder, oauth, config_dict, info)
def test_store_provider(self): self.meta.uuid = None uuid = store_provider(meta=self.meta, config_dict=mock_config_dict) update_config_provider(self.meta, config_dict=mock_config_dict) delete_provider(uuid)
def test_store_provider(self): uuid = store_provider(meta=self.meta) update_config_provider(self.meta) delete_provider(uuid)