server/test: fix tests after post flags became strings

This commit is contained in:
Hunternif 2019-04-16 14:49:46 +07:00
parent 8e1e6af232
commit fdc52162d5
3 changed files with 4 additions and 4 deletions

View file

@ -29,7 +29,7 @@ def get_post_snapshot(post: model.Post) -> Dict[str, Any]:
'source': post.source,
'safety': post.safety,
'checksum': post.checksum,
'flags': sorted(post.flags.split(',')),
'flags': sorted([x for x in post.flags.split(',') if x]),
'featured': post.is_featured,
'tags': sorted([tag.first_name for tag in post.tags]),
'relations': sorted([rel.post_id for rel in post.relations]),

View file

@ -202,7 +202,7 @@ def post_factory(skip_post_hashing):
post.safety = safety
post.type = type
post.checksum = checksum
post.flags = []
post.flags = ''
post.mime_type = 'application/octet-stream'
post.creation_time = datetime(1996, 1, 1)
return post

View file

@ -112,7 +112,7 @@ def test_serialize_post(
post.user = user_factory(name='post author')
post.canvas_width = 200
post.canvas_height = 300
post.flags = ['loop']
post.flags = 'loop'
db.session.add(post)
db.session.flush()
@ -654,7 +654,7 @@ def test_update_post_notes_with_invalid_content(input):
def test_update_post_flags():
post = model.Post()
posts.update_post_flags(post, ['loop'])
assert post.flags == ['loop']
assert post.flags == 'loop'
def test_update_post_flags_with_invalid_content():