Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
RANKGUN_TOKEN="*****"
WORKSPACE_ID="***"
TESTING_USER_ID="***"
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Run tests
env:
RANKGUN_TOKEN: ${{ secrets.RANKGUN_TOKEN }}
WORKSPACE_ID: ${{ secrets.WORKSPACE_ID }}
TESTING_USER_ID: ${{ secrets.TESTING_USER_ID }}
run: uv run python -m pytest tests

- name: Check typing
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ git clone git@github.com:YOUR_NAME/rankgun.git
cd rankgun
```

Copy ``.example.env`` to ``.env`` and set your variables as necessary.

Then, install and activate the environment with:

```bash
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dev = [
"deptry>=0.23.0",
"mypy>=0.991",
"ruff>=0.11.5",
"python-dotenv>=1.1.0",
]

[build-system]
Expand Down
11 changes: 0 additions & 11 deletions tests/test_example.py

This file was deleted.

36 changes: 36 additions & 0 deletions tests/test_ranks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Tests for ranking logic."""

import os

from dotenv import load_dotenv

from src.rankgun.main import Client

load_dotenv()


TOKEN = os.environ["RANKGUN_TOKEN"]
WID = os.environ["WORKSPACE_ID"]
TESTINGUSERID = os.environ["TESTING_USER_ID"]

client = Client(wid=WID, token=TOKEN)


def test_set_rank_one():
"""Sets the rank of a test user."""
assert client.setRank(TESTINGUSERID, 3).user == f"users/{TESTINGUSERID}"


def test_promotion():
"""Promote a test user."""
assert client.promote(TESTINGUSERID).user == f"users/{TESTINGUSERID}"


def test_demotion():
"""Demote a test user."""
assert client.demote(TESTINGUSERID).user == f"users/{TESTINGUSERID}"


def test_set_rank_two():
"""Sets the rank of a test user."""
assert client.setRank(TESTINGUSERID, 2).user == f"users/{TESTINGUSERID}"
11 changes: 11 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading