feat: implement new storage design per issue #2
- Storage: Change from per-user to per-group JSON files
- Data location: ~/.jigaido/ instead of apps/telegram-bot/data/
- Group bounties: data/{group_id}/group.json
- User tracking: data/{group_id}/{user_id}.json
- Personal bounties: data/{user_id}/user.json
- Update commands.py for new storage model
- Update bot.py to remove admin handlers
- Update tests to reflect created_by_user_id field
- Update SPEC.md with new design
Addresses user feedback from issue #2
This commit is contained in:
@@ -101,12 +101,21 @@ class TestParseArgs:
|
||||
|
||||
|
||||
class TestFormatBounty:
|
||||
def _row(self, id=1, text="Test bounty", link="https://example.com",
|
||||
due_date_ts=None, informed_by_username="alice"):
|
||||
def _row(
|
||||
self,
|
||||
id=1,
|
||||
text="Test bounty",
|
||||
link="https://example.com",
|
||||
due_date_ts=None,
|
||||
created_by_user_id=123456,
|
||||
):
|
||||
row = MagicMock()
|
||||
row.__getitem__ = lambda s, k: {
|
||||
"id": id, "text": text, "link": link,
|
||||
"due_date_ts": due_date_ts, "informed_by_username": informed_by_username
|
||||
"id": id,
|
||||
"text": text,
|
||||
"link": link,
|
||||
"due_date_ts": due_date_ts,
|
||||
"created_by_user_id": created_by_user_id,
|
||||
}[k]
|
||||
return row
|
||||
|
||||
@@ -155,12 +164,7 @@ class TestFormatBounty:
|
||||
out = format_bounty(b)
|
||||
assert "OVERDUE" in out
|
||||
|
||||
def test_informed_by_shown(self):
|
||||
b = self._row(informed_by_username="bob")
|
||||
def test_created_by_shown(self):
|
||||
b = self._row(created_by_user_id=999)
|
||||
out = format_bounty(b)
|
||||
assert "@bob" in out
|
||||
|
||||
def test_informed_by_unknown_fallback(self):
|
||||
b = self._row(informed_by_username=None)
|
||||
out = format_bounty(b)
|
||||
assert "@unknown" in out
|
||||
assert "999" in out
|
||||
|
||||
Reference in New Issue
Block a user