server_url = 'https://%s:%d/user-%s' % \ (soledad_hosts[host]['hostname'], soledad_hosts[host]['port'], auth['id']) # get provider ca certificate #ca_cert = requests.get('https://127.0.0.1/ca.crt', verify=False).text #cert_file = os.path.join(tempdir, 'ca.crt') cert_file = None # not used for now #with open(cert_file, 'w') as f: # f.write(ca_cert) return auth['id'], server_url, cert_file, auth['token'] def can_sync_soledad_fine(): tempdir = tempfile.mkdtemp() try: uuid, server_url, cert_file, token = \ get_soledad_info(Config(), tempdir) # in the future, we can replace the following by an actual Soledad # client sync, if needed db = u1db.open(os.path.join(tempdir, '%s.db' % uuid), True) creds = {'token': {'uuid': uuid, 'token': token}} db.sync(server_url, creds=creds, autocreate=False) finally: shutil.rmtree(tempdir) if __name__ == '__main__': from support import nagios_test exit_code = nagios_test.run(can_sync_soledad_fine) exit(exit_code)
#!/usr/bin/env python # Test Signup and Login with the webapp API works. from support.api import Api from support.config import Config from support.user import User def signup_successfully(): config = Config() user = User() api = Api(config, verify=False) user.signup(api) user.login(api) if __name__ == '__main__': from support import nagios_test exit_code = nagios_test.run(signup_successfully) exit(exit_code)
host = soledad_hosts.keys()[0] server_url = 'https://%s:%d/user-%s' % \ (soledad_hosts[host]['hostname'], soledad_hosts[host]['port'], auth['id']) # get provider ca certificate #ca_cert = requests.get('https://127.0.0.1/ca.crt', verify=False).text #cert_file = os.path.join(tempdir, 'ca.crt') cert_file = None # not used for now #with open(cert_file, 'w') as f: # f.write(ca_cert) return auth['id'], server_url, cert_file, auth['token'] def can_sync_soledad_fine(): tempdir = tempfile.mkdtemp() try: uuid, server_url, cert_file, token = \ get_soledad_info(Config(), tempdir) # in the future, we can replace the following by an actual Soledad # client sync, if needed db = u1db.open(os.path.join(tempdir, '%s.db' % uuid), True) creds = {'token': {'uuid': uuid, 'token': token}} db.sync(server_url, creds=creds, autocreate=False) finally: shutil.rmtree(tempdir) if __name__ == '__main__': from support import nagios_test exit_code = nagios_test.run(can_sync_soledad_fine) exit(exit_code)
#!/usr/bin/env python # Test Authentication with the webapp API works. from support.api import Api from support.config import Config from support.user import User def login_successfully(): config = Config() user = User(config) api = Api(config, verify=False) user.login(api) if __name__ == '__main__': from support import nagios_test exit_code = nagios_test.run(login_successfully) exit(exit_code)