Skip to content

Commit eec65c0

Browse files
committed
Add test asserting join behavior
1 parent 3745410 commit eec65c0

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

contentcuration/contentcuration/tests/test_user.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,27 @@ def test_user_csv_export_reports_staged_files(self):
218218
self.assertEqual(staged_row["File Size"], _format_size(2048))
219219
self.assertEqual(staged_row["URL"], "")
220220

221+
def test_user_csv_export_includes_files_without_contentnode(self):
222+
file_without_contentnode = fileobj_video()
223+
self.assertIsNone(file_without_contentnode.contentnode_id)
224+
file_without_contentnode.uploaded_by = self.user
225+
file_without_contentnode.original_filename = "no-contentnode.mp4"
226+
file_without_contentnode.save()
227+
228+
with tempfile.NamedTemporaryFile(suffix=".csv") as tempf:
229+
write_user_csv(self.user, path=tempf.name)
230+
231+
with io.open(tempf.name, "r", encoding="utf-8") as csv_file:
232+
rows = list(csv.DictReader(csv_file, delimiter=","))
233+
234+
row = next(
235+
row
236+
for row in rows
237+
if row["Filename"] == file_without_contentnode.original_filename
238+
)
239+
self.assertEqual(row["Title"], "No resource")
240+
self.assertEqual(row["Channel"], "No Channel")
241+
221242

222243
class UserEffectiveDiskSpaceTest(StudioTestCase):
223244
def setUp(self):

0 commit comments

Comments
 (0)