From f42e23ad9847e11e86c77623eb77da3355b6d71b Mon Sep 17 00:00:00 2001 From: mo khan Date: Mon, 9 Jun 2025 13:51:29 -0600 Subject: test: switch to rspec --- bin/cibuild | 1 + bin/test | 63 ++----------------------------------------------------------- 2 files changed, 3 insertions(+), 61 deletions(-) (limited to 'bin') diff --git a/bin/cibuild b/bin/cibuild index 391ed8e..2a9dec8 100755 --- a/bin/cibuild +++ b/bin/cibuild @@ -13,5 +13,6 @@ apt update apt install -y mise mise install +bundle install ./bin/test mise exec -- cargo test diff --git a/bin/test b/bin/test index be8878b..047eff3 100755 --- a/bin/test +++ b/bin/test @@ -1,62 +1,3 @@ -#!/usr/bin/env ruby +#!/bin/sh -require "bundler/inline" - -gemfile do - source "https://rubygems.org" - - gem "minitest", "~> 5.0" - gem "net-hippie", "~> 1.0" -end - -$bind_addr = ENV.fetch("BIND_ADDR", "127.0.0.1:7878") - -pid = Process.spawn({ - "BIND_ADDR" => $bind_addr -}, "mise exec -- cargo run") -sleep 1 - -at_exit do - Process.kill('SIGTERM', pid) - system("killall sts") -end - -require "minitest/autorun" - -class ServerTest < Minitest::Test - attr_reader :base_url, :client - - def setup - @base_url = "http://#{$bind_addr}" - @client = Net::Hippie::Client.new - end - - def test_homepage - response = client.get(base_url + "/") - assert_equal response.code, "200" - end - - def test_not_found - response = client.get(base_url + "/404") - assert_equal "404", response.code - end - - # /.well-known/oauth-authorization-server https://datatracker.ietf.org/doc/html/rfc8414#section-3.1 - def test_metadata - response = client.get(base_url + "/.well-known/oauth-authorization-server") - assert_equal "200", response.code - assert_equal "application/json", response["Content-Type"] - end - - # /token - Token endpoint https://datatracker.ietf.org/doc/html/rfc8693#section-2.3 - def test_token - end - - # /introspect - Token introspection https://datatracker.ietf.org/doc/html/rfc7662#section-2 - def test_introspect - end - - # /revoke - Token revocation # https://datatracker.ietf.org/doc/html/rfc7009#section-2.1 - def test_revoke - end -end +bundle exec rspec -- cgit v1.2.3