Initialize public HG Inschrijvingen source
This commit is contained in:
commit
c84fea26a0
23 files changed
+1623
No files matched your search
@@ -0,0 +1,32 @@
|
||||
"""WP-CLI access for the isolated registrations test scripts."""
|
||||
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
|
||||
def add_wordpress_arguments(parser):
|
||||
parser.add_argument('--wp-path', required=True, help='WordPress root of the staging installation')
|
||||
parser.add_argument('--wp-cli', default='wp', help='WP-CLI executable')
|
||||
|
||||
|
||||
class WordPress:
|
||||
def __init__(self, args):
|
||||
self.command = [args.wp_cli, '--path=' + args.wp_path, 'eval', 'eval(stream_get_contents(STDIN));']
|
||||
self.info = self.json("""
|
||||
if (wp_get_environment_type() !== 'staging' || !function_exists('hgr_reserve')) {
|
||||
WP_CLI::error('Use a staging installation with HG Inschrijvingen active.');
|
||||
}
|
||||
echo wp_json_encode([
|
||||
'home' => home_url(), 'admin' => admin_url(), 'login' => wp_login_url(),
|
||||
'mail_blocked' => defined('HGR_TEST_MAIL_BLOCKED'),
|
||||
]);
|
||||
""")
|
||||
|
||||
def eval(self, code):
|
||||
result = subprocess.run(self.command, input=code, text=True, capture_output=True, timeout=20)
|
||||
if result.returncode:
|
||||
raise RuntimeError(result.stderr.strip())
|
||||
return result.stdout
|
||||
|
||||
def json(self, code):
|
||||
return json.loads(self.eval(code))
|
||||
Reference in new issue
Block a user