Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk committed Aug 27, 2024
1 parent bc30718 commit 61eb312
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions redturtle/bandi/tests/example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xxx
30 changes: 30 additions & 0 deletions redturtle/bandi/tests/test_bando_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
from plone import api
from plone.app.testing import setRoles
from plone.app.testing import TEST_USER_ID
from plone.namedfile.file import NamedBlobFile

import os
import unittest


Expand Down Expand Up @@ -105,3 +107,31 @@ def test_tipologia_bando_in_right_view(self):
)
self.assertIn("Announcement type", view_new())
self.assertIn("Altro", view_new())

def test_dates_in_attachments(self):
folder = api.content.create(
container=self.bando, type="Bando Folder Deepening", title="attachments"
)

filename = os.path.join(os.path.dirname(__file__), "example.txt")
api.content.create(
container=folder,
type="File",
title="attachment",
file=NamedBlobFile(
data=open(filename, "rb").read(),
filename="example.txt",
contentType="text/plain",
),
)

view = api.content.get_view(
name="bando_view", context=self.bando, request=self.request
)
data = view.retrieveContentsOfFolderDeepening(
"/".join(folder.getPhysicalPath())
)

self.assertEqual(len(data), 1)
self.assertIn("modified", data[0])
self.assertIn("effective", data[0])

0 comments on commit 61eb312

Please sign in to comment.