Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions tst/data/live_github_website/server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""A live site for integration tests: github.com, whose pages its server serves none of. Its data plane reads a public
repository through api.github.com and keeps what a task loads; its session is a test cookie, which GitHub ignores."""
repository through api.github.com and keeps what a task loads; its session is a test cookie, which GitHub ignores. It's
ready when github.com answers: the API allows an unauthenticated caller 60 calls an hour, which CI's shared addresses
spend, so only a read of its state calls it."""
import json
import urllib.request
from typing import Optional
Expand Down Expand Up @@ -31,8 +33,9 @@ def repository(self) -> dict:
return self._repository

@ready_check
def api_answers(self) -> bool:
return self.repository()["full_name"] == self.settings.repository
def site_answers(self) -> bool:
with urllib.request.urlopen(urllib.request.Request("https://github.com/", method="HEAD"), timeout=10) as response:
return response.status == 200

@session_state
def account(self, user: Optional[str]) -> dict:
Expand Down
Loading