Separate system accounts and household people, add generation directory and consented member location sharing
This commit is contained in:
@@ -37,6 +37,35 @@ class JournalTests(unittest.TestCase):
|
||||
self.assertEqual(app.JOURNAL.snapshot(user, {'mode':'person','person':self.actor['id']})['items'], [])
|
||||
self.assertEqual(self.request('/api/journal/action', user, dict(id=key,action='like',liked=True))[0], 404)
|
||||
|
||||
def test_real_participant_without_login_has_history_but_no_implicit_read_access(self):
|
||||
mother = app.MEMBERS.save(self.owner, dict(name='未注册的妈妈'))
|
||||
body = self.note(participantIds=[mother['personId']])
|
||||
key = app.JOURNAL.save(self.actor, body)['id']
|
||||
query = dict(mode='person', person=mother['personId'])
|
||||
self.assertEqual(app.JOURNAL.snapshot(self.actor, query)['items'][0]['id'], key)
|
||||
for actor in (self.owner, self.root, self.other):
|
||||
self.assertEqual(app.JOURNAL.snapshot(actor, query)['items'], [])
|
||||
old = app.get_object('journal_entries', key)
|
||||
app.JOURNAL.save(self.actor, dict(old, visibility='household'))
|
||||
self.assertEqual(app.JOURNAL.snapshot(self.owner, query)['items'][0]['id'], key)
|
||||
self.assertEqual(app.JOURNAL.snapshot(self.other, query)['items'], [])
|
||||
self.assertFalse(any(u.get('personId') == mother['personId'] for u in app.objects('users')))
|
||||
current = app.get_object('journal_entries', key)
|
||||
del current['participantIds']
|
||||
app.JOURNAL.save(self.actor, dict(current, text='修改正文'))
|
||||
self.assertEqual(app.get_object('journal_entries', key)['participantIds'], [mother['personId']])
|
||||
current = app.get_object('journal_entries', key)
|
||||
app.JOURNAL.save(self.actor, dict(current, participantIds=[]))
|
||||
self.assertEqual(app.JOURNAL.snapshot(self.owner, query)['items'], [])
|
||||
|
||||
def test_participant_must_be_registered_in_current_household(self):
|
||||
foreign = app.MEMBERS.save(self.other, dict(name='另一家的参与人'))
|
||||
with self.assertRaises(app.Problem):
|
||||
app.JOURNAL.save(self.actor, self.note(participantIds=[foreign['personId']]))
|
||||
app.MEMBERS.share_genealogy(self.root, dict(targetFamilyId=self.bid, confirm=True))
|
||||
with self.assertRaises(app.Problem):
|
||||
app.JOURNAL.save(self.actor, self.note(participantIds=[foreign['personId']]))
|
||||
|
||||
def test_shared_feed_history_search_and_date_filters_reference_the_same_record(self):
|
||||
key = self.saved(visibility='household')
|
||||
for mode in ('feed','person'):
|
||||
|
||||
Reference in New Issue
Block a user