# -*- coding: utf-8 -*-
from __future__ import annotations

import uuid

from hotpocket_backend.apps.accounts.models import AuthKey


class AuthKeysTestingService:
    def assert_created(self,
                       *,
                       key: str,
                       account_uuid: uuid.UUID,
                       ):
        auth_key = AuthKey.objects.get(key=key)
        assert auth_key.account_uuid == account_uuid

        assert auth_key.created_at is not None
        assert auth_key.updated_at is not None

    def assert_deleted(self,
                       pk: uuid.UUID,
                       ):
        query_set = AuthKey.objects.filter(pk=pk)
        assert query_set.exists() is False

    def assert_exists(self,
                      pk: uuid.UUID,
                      ):
        query_set = AuthKey.objects.filter(pk=pk)
        assert query_set.count() == 1
