Skip to content

Commit 124c84b

Browse files
Clean Up Artifact Tests
Signed-off-by: Hassan Abouelela <[email protected]>
1 parent 26a3c19 commit 124c84b

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

pydis_site/apps/api/tests/test_github_utils.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def encode(payload: dict, _: str, algorithm: str, *args, **kwargs) -> str:
2121
"""
2222
Intercept the encode method.
2323
24-
It is performed with an algorithm which does not require a PEM key, as it may
24+
The result is encoded with an algorithm which does not require a PEM key, as it may
2525
not be available in testing environments.
2626
"""
2727
self.assertEqual("RS256", algorithm, "The GitHub App JWT must be signed using RS256.")
@@ -39,10 +39,11 @@ def encode(payload: dict, _: str, algorithm: str, *args, **kwargs) -> str:
3939
self.assertLess(decoded["exp"], (datetime.datetime.now() + delta).timestamp())
4040

4141

42-
class WaitForTests(unittest.TestCase):
42+
class CheckRunTests(unittest.TestCase):
4343
"""Tests the check_run_status utility."""
4444

4545
def test_completed_run(self):
46+
"""Test that an already completed run returns the correct URL."""
4647
final_url = "some_url_string_1234"
4748

4849
result = github_utils.check_run_status({
@@ -245,20 +246,17 @@ def test_valid(self):
245246
class GitHubArtifactViewTests(django.test.TestCase):
246247
"""Test the GitHub artifact fetch API view."""
247248

248-
@classmethod
249-
def setUpClass(cls):
250-
super().setUpClass()
251-
252-
cls.kwargs = {
249+
def setUp(self):
250+
self.kwargs = {
253251
"owner": "test_owner",
254252
"repo": "test_repo",
255253
"sha": "test_sha",
256254
"action_name": "test_action",
257255
"artifact_name": "test_artifact",
258256
}
259-
cls.url = reverse("api:github-artifacts", kwargs=cls.kwargs)
257+
self.url = reverse("api:github-artifacts", kwargs=self.kwargs)
260258

261-
def test_successful(self, artifact_mock: mock.Mock):
259+
def test_correct_artifact(self, artifact_mock: mock.Mock):
262260
"""Test a proper response is returned with proper input."""
263261
artifact_mock.return_value = "final download url"
264262
result = self.client.get(self.url)

0 commit comments

Comments
 (0)