Spaces:
Configuration error
Configuration error
File size: 686 Bytes
1fea2ad |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import app
class Token:
def __init__(self, token): self.token = token
def test_api_requires_token():
hf_token = os.environ.get("HF_TOKEN")
assert hf_token, "HF_TOKEN not set in environment"
gen = app.respond(
message="Hi",
history=[],
system_message="test",
max_tokens=8,
temperature=0.2,
top_p=0.9,
hf_token=Token(hf_token),
selected_model="openai/gpt-oss-20b (api)",
)
first = next(gen)
assert "please log in" not in first.lower() # shouldn't get warning
assert isinstance(first, str)
|