Skip to content

Commit 51a0d6d

Browse files
committed
Include update date in Note.to_ap
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent d1cbb92 commit 51a0d6d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

fedcode/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def to_ap(self):
233233
"type": "Note",
234234
"author": self.acct,
235235
"content": self.content,
236-
"update_date": self.updated_at,
236+
"update_date": str(self.updated_at),
237237
}
238238

239239

tests/test_ap_api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,14 @@ def test_get_user_inbox(person, vulnerability, review, package):
209209
"type": "Note",
210210
"author": "pkg:maven/org.apache.logging@127.0.0.1:8000",
211211
"content": "yaml data1",
212+
"update_date": str(note1.updated_at),
212213
},
213214
{
214215
"id": f"https://127.0.0.1:8000/notes/{note2.id}",
215216
"type": "Note",
216217
"author": "pkg:maven/org.apache.logging@127.0.0.1:8000",
217218
"content": "yaml data2",
219+
"update_date": str(note2.updated_at),
218220
},
219221
],
220222
},
@@ -282,6 +284,7 @@ def test_get_user_outbox(person, vulnerability, review, note):
282284
"content": note.content,
283285
"id": f"https://127.0.0.1:8000/notes/{note.id}",
284286
"type": "Note",
287+
"update_date": str(note.updated_at),
285288
}
286289
],
287290
},
@@ -383,6 +386,7 @@ def test_get_package_inbox(package, service):
383386
"[] fixing_vulnerabilities: []",
384387
"id": f"https://127.0.0.1:8000/notes/{note1.id}",
385388
"type": "Note",
389+
"update_date": str(note1.updated_at),
386390
}
387391
],
388392
"totalItems": 1,
@@ -413,6 +417,7 @@ def test_get_package_outbox(service, package):
413417
"content": "yaml data1",
414418
"id": f"https://127.0.0.1:8000/notes/{note1.id}",
415419
"type": "Note",
420+
"update_date": str(note1.updated_at),
416421
}
417422
],
418423
"totalItems": 1,

tests/test_vocabulary_toap.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def test_objects_to_ap(repo, review, vulnerability, note, rep, mute_post_save_si
158158
"id": f"https://127.0.0.1:8000/notes/{note.id}",
159159
"author": note.acct,
160160
"content": note.content,
161+
"update_date": str(note.updated_at),
161162
}
162163

163164
assert rep.to_ap == {
@@ -168,5 +169,6 @@ def test_objects_to_ap(repo, review, vulnerability, note, rep, mute_post_save_si
168169
"id": f"https://127.0.0.1:8000/notes/{note.id}",
169170
"author": note.acct,
170171
"content": note.content,
172+
"update_date": str(note.updated_at),
171173
},
172174
}

0 commit comments

Comments
 (0)