Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 18, 2024
1 parent 333182e commit d061039
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
4 changes: 1 addition & 3 deletions ark_nova_stats/api/gql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ def Schema(app):
mutation=GraphQLObjectType(
name="Mutation",
fields={
"submitGameLogs": submit_game_logs_field(
GameLog
),
"submitGameLogs": submit_game_logs_field(GameLog),
},
),
)
5 changes: 2 additions & 3 deletions ark_nova_stats/api/gql/types/game_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def game_log_field(game_log: type[GameLog]) -> GraphQLField:
resolve=lambda root, info, **args: fetch_game_log(game_log, args),
)


def submit_game_logs(
game_log_model: Type[GameLog],
args: dict[str, Any],
Expand Down Expand Up @@ -87,7 +88,5 @@ def submit_game_logs_field(
description="JSON-encoded representation of game logs.",
),
},
resolve=lambda root, info, **args: submit_game_logs(
game_log_model, args
),
resolve=lambda root, info, **args: submit_game_logs(game_log_model, args),
)
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
"""create-game-logs
Revision ID: 2ce11871a414
Revises:
Revises:
Create Date: 2024-07-18 00:11:53.246321
"""
from alembic import op

import sqlalchemy as sa
from alembic import op
from sqlalchemy.sql.functions import now


# revision identifiers, used by Alembic.
revision = '2ce11871a414'
revision = "2ce11871a414"
down_revision = None
branch_labels = None
depends_on = None
Expand Down
2 changes: 1 addition & 1 deletion ark_nova_stats/api/tests/fixtures/sample_game.log.json

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions ark_nova_stats/api/tests/game_log_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ def test_submit_game_logs(client: FlaskClient) -> None:
""",
"variables": {
"logs": game_log,
}
},
},
)
assert response.json.get("data", {}), f"data field not set on response json: {response.json}"
assert response.json["data"].get("submitGameLogs", {}), f"submitGameLogs field not set on response json: {response.json['data']}"
assert response.json["data"]["submitGameLogs"].get("log", "") == game_log, f"game log was not expected value: {response.json}"
assert response.json.get(
"data", {}
), f"data field not set on response json: {response.json}"
assert response.json["data"].get(
"submitGameLogs", {}
), f"submitGameLogs field not set on response json: {response.json['data']}"
assert (
response.json["data"]["submitGameLogs"].get("log", "") == game_log
), f"game log was not expected value: {response.json}"


if __name__ == "__main__":
sys.exit(pytest.main([__file__] + sys.argv[1:]))
1 change: 1 addition & 0 deletions ark_nova_stats/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from ark_nova_stats.config import db


@dataclasses.dataclass
class GameLogDataLogDataJSON:
uid: str
Expand Down

0 comments on commit d061039

Please sign in to comment.