mirror of
https://github.com/rjNemo/pass-gen
synced 2026-06-06 02:26:42 +00:00
22 lines
573 B
Python
22 lines
573 B
Python
from __future__ import annotations
|
|
|
|
from app.models.password import Password
|
|
|
|
|
|
class FakeRepository:
|
|
_values = {}
|
|
|
|
def save(self, service: str, password: str) -> None:
|
|
self._values[service] = password
|
|
|
|
def list_all(self) -> list[Password]:
|
|
return [
|
|
Password(id=i, service=v[0], password=v[1]) for i, v in enumerate(self._values.items())
|
|
]
|
|
|
|
def exists(self, service: str) -> bool:
|
|
return service in self._values.keys()
|
|
|
|
@classmethod
|
|
def get_instance(cls) -> FakeRepository:
|
|
return FakeRepository()
|