• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

andgineer / api-db-prototype / 8766121206

20 Apr 2024 03:45PM UTC coverage: 83.956% (-2.9%) from 86.892%
8766121206

push

github

andgineer
upgrade reqs

2 of 2 new or added lines in 2 files covered. (100.0%)

89 existing lines in 23 files now uncovered.

1057 of 1259 relevant lines covered (83.96%)

0.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/src/controllers/users/get.py
1
from typing import Any, Dict, Union
1✔
2

3
import controllers.models
1✔
4
import db.conn
1✔
5
import db.models
1✔
6
from controllers.auth import AuthUser
1✔
7
from controllers.helper import api_result, token_to_auth_user, transaction
1✔
8
from controllers.models import HttpCode
1✔
9

10

11
# mypy: disallow_untyped_decorators=False
12
@api_result
1✔
13
@transaction
1✔
14
@token_to_auth_user
1✔
15
# CI gets types from controllers.model but locally thinks it's untyped, so this `Any` hack to suppress error on return
16
def get_user(auth_user: AuthUser, user_id: str) -> Union[Dict[str, Any], Any]:
1✔
17
    """Get specific user details."""
18
    if not auth_user.is_admin:
1✔
UNCOV
19
        return "Only admin can get info about user", HttpCode.unauthorized
×
20
    if user := db.models.User.by_id(user_id):
1✔
21
        return controllers.models.User().from_orm(user).as_dict  # pylint: disable=c-extension-no-member
1✔
UNCOV
22
    return f"No user with id={user_id}", HttpCode.logic_error
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc