main (int argc,
      char *argv[])
{
  cockpit_ws_session_program = BUILDDIR "/mock-auth-command";
  cockpit_ws_service_idle = 1;
  cockpit_ws_process_idle = 2;

  cockpit_test_init (&argc, &argv);

  g_test_add ("/auth/application", Test, NULL, NULL, test_application, NULL);
  g_test_add ("/auth/userpass-header-check", Test, NULL, setup, test_userpass_cookie_check, teardown);
  g_test_add ("/auth/userpass-bad", Test, NULL, setup, test_userpass_bad, teardown);
  g_test_add ("/auth/userpass-emptypass", Test, NULL, setup, test_userpass_emptypass, teardown);
  g_test_add ("/auth/headers-bad", Test, NULL, setup, test_headers_bad, teardown);
  g_test_add ("/auth/idle-timeout", Test, NULL, setup, test_idle_timeout, teardown);
  g_test_add ("/auth/process-timeout", Test, NULL, setup, test_process_timeout, teardown);
  g_test_add ("/auth/bad-coversation", Test, &fixture_bad_conversation,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-success", Test, &fixture_no_data,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-no-cookie-success", Test, &fixture_no_cookie,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-data-then-success", Test, &fixture_data_then_success,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-fail-auth", Test, &fixture_auth_failed,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-denied-auth", Test, &fixture_auth_denied,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-with-error", Test, &fixture_auth_with_error,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-timeout", Test, &fixture_auth_timeout,
              setup_normal, test_custom_timeout, teardown_normal);

  g_test_add ("/auth/custom-ssh-basic-success", Test, &fixture_ssh_basic,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-basic-success-not-authorized", Test, &fixture_ssh_not_authorized,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-remote-basic-success", Test, &fixture_ssh_remote_basic,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-remote-switched", Test, &fixture_ssh_remote_switched,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-with-conf-default", Test, &fixture_ssh_alt_default,
              setup_alt_config, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-with-conf-allow", Test, &fixture_ssh_alt,
              setup_alt_config, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-success", Test, &fixture_ssh_no_data,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-fail-auth", Test, &fixture_ssh_auth_failed,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-ssh-fail-basic-auth", Test, &fixture_ssh_basic_failed,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-ssh-remote-fail-basic-auth", Test, &fixture_ssh_remote_basic_failed,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-ssh-not-supported", Test, &fixture_ssh_not_supported,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-ssh-with-error", Test, &fixture_ssh_auth_with_error,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/success-ssh-multi-step-three", Test, &fixture_ssh_three_steps,
              setup_normal, test_multi_step_success, teardown_normal);
  g_test_add ("/auth/fail-ssh-multi-step-two", Test, &fixture_fail_ssh_two_steps,
              setup_normal, test_multi_step_fail, teardown_normal);

  g_test_add ("/auth/none", Test, &fixture_auth_none,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/bad-command", Test, &fixture_bad_command,
              setup_normal, test_bad_command, teardown_normal);
  g_test_add ("/auth/success-multi-step-two", Test, &fixture_two_steps,
              setup_normal, test_multi_step_success, teardown_normal);
  g_test_add ("/auth/success-multi-step-three", Test, &fixture_three_steps,
              setup_normal, test_multi_step_success, teardown_normal);
  g_test_add ("/auth/fail-multi-step-two", Test, &fixture_fail_two_steps,
              setup_normal, test_multi_step_fail, teardown_normal);
  g_test_add ("/auth/fail-multi-step-three", Test, &fixture_fail_three_steps,
              setup_normal, test_multi_step_fail, teardown_normal);
  g_test_add ("/auth/fail-multi-step-timeout", Test, &fixture_fail_step_timeout,
              setup_normal, test_multi_step_fail, teardown_normal);
  g_test_add ("/auth/max-startups", Test, NULL,
              setup_normal, test_max_startups, teardown_normal);
  g_test_add ("/auth/max-startups-normal", Test, &fixture_normal,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-single", Test, &fixture_single,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-double", Test, &fixture_double,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-unlimited", Test, &fixture_unlimited,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-bad", Test, &fixture_bad,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-bad-rate", Test, &fixture_bad_rate,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-bad-startups", Test, &fixture_bad_startups,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-bad-negative", Test, &fixture_bad_negative,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-too-many", Test, &fixture_bad_too_many,
              setup_startups, test_max_startups_conf, teardown_startups);
  return g_test_run ();
}
main (int argc,
      char *argv[])
{
  cockpit_ws_session_program = BUILDDIR "/mock-auth-command";
  cockpit_ws_service_idle = 1;
  cockpit_ws_process_idle = 2;

  cockpit_test_init (&argc, &argv);

  g_test_add ("/auth/application", Test, NULL, NULL, test_application, NULL);
  g_test_add ("/auth/userpass-header-check", Test, NULL, setup, test_userpass_cookie_check, teardown);
  g_test_add ("/auth/userpass-bad", Test, NULL, setup, test_userpass_bad, teardown);
  g_test_add ("/auth/userpass-emptypass", Test, NULL, setup, test_userpass_emptypass, teardown);
  g_test_add ("/auth/headers-bad", Test, NULL, setup, test_headers_bad, teardown);
  g_test_add ("/auth/idle-timeout", Test, NULL, setup, test_idle_timeout, teardown);
  g_test_add ("/auth/process-timeout", Test, NULL, setup, test_process_timeout, teardown);
  g_test_add ("/auth/bad-coversation", Test, &fixture_bad_conversation,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-success", Test, &fixture_no_data,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-no-cookie-success", Test, &fixture_no_cookie,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-data-then-success", Test, &fixture_data_then_success,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-fail-auth", Test, &fixture_auth_failed,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-denied-auth", Test, &fixture_auth_denied,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-with-error", Test, &fixture_auth_with_error,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-timeout", Test, &fixture_auth_timeout,
              setup_normal, test_custom_timeout, teardown_normal);

  g_test_add ("/auth/custom-ssh-basic-success", Test, &fixture_ssh_basic,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-basic-success-not-authorized", Test, &fixture_ssh_not_authorized,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-remote-basic-success", Test, &fixture_ssh_remote_basic,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-remote-switched", Test, &fixture_ssh_remote_switched,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-with-conf-default", Test, &fixture_ssh_alt_default,
              setup_alt_config, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-with-conf-allow", Test, &fixture_ssh_alt,
              setup_alt_config, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-success", Test, &fixture_ssh_no_data,
              setup_normal, test_custom_success, teardown_normal);
  g_test_add ("/auth/custom-ssh-fail-auth", Test, &fixture_ssh_auth_failed,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-ssh-fail-basic-auth", Test, &fixture_ssh_basic_failed,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-ssh-remote-fail-basic-auth", Test, &fixture_ssh_remote_basic_failed,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-ssh-not-supported", Test, &fixture_ssh_not_supported,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/custom-ssh-with-error", Test, &fixture_ssh_auth_with_error,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/success-ssh-multi-step-three", Test, &fixture_ssh_three_steps,
              setup_normal, test_multi_step_success, teardown_normal);
  g_test_add ("/auth/fail-ssh-multi-step-two", Test, &fixture_fail_ssh_two_steps,
              setup_normal, test_multi_step_fail, teardown_normal);

  g_test_add ("/auth/none", Test, &fixture_auth_none,
              setup_normal, test_custom_fail, teardown_normal);
  g_test_add ("/auth/bad-command", Test, &fixture_bad_command,
              setup_normal, test_bad_command, teardown_normal);
  g_test_add ("/auth/success-multi-step-two", Test, &fixture_two_steps,
              setup_normal, test_multi_step_success, teardown_normal);
  g_test_add ("/auth/success-multi-step-three", Test, &fixture_three_steps,
              setup_normal, test_multi_step_success, teardown_normal);
  g_test_add ("/auth/fail-multi-step-two", Test, &fixture_fail_two_steps,
              setup_normal, test_multi_step_fail, teardown_normal);
  g_test_add ("/auth/fail-multi-step-three", Test, &fixture_fail_three_steps,
              setup_normal, test_multi_step_fail, teardown_normal);
  g_test_add ("/auth/fail-multi-step-timeout", Test, &fixture_fail_step_timeout,
              setup_normal, test_multi_step_fail, teardown_normal);
  g_test_add ("/auth/max-startups", Test, NULL,
              setup_normal, test_max_startups, teardown_normal);
  g_test_add ("/auth/max-startups-normal", Test, &fixture_normal,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-single", Test, &fixture_single,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-double", Test, &fixture_double,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-unlimited", Test, &fixture_unlimited,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-bad", Test, &fixture_bad,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-bad-rate", Test, &fixture_bad_rate,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-bad-startups", Test, &fixture_bad_startups,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-bad-negative", Test, &fixture_bad_negative,
              setup_startups, test_max_startups_conf, teardown_startups);
  g_test_add ("/auth/max-startups-too-many", Test, &fixture_bad_too_many,
              setup_startups, test_max_startups_conf, teardown_startups);
  return g_test_run ();
}