-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_urls.py
More file actions
102 lines (79 loc) · 2.93 KB
/
test_urls.py
File metadata and controls
102 lines (79 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from django.urls import resolve
from django.urls import reverse
from democrasite.activitypub.models import Note
from democrasite.activitypub.models import Person
def test_list():
assert reverse("activitypub:note-list") == "/activitypub/notes/"
assert resolve("/activitypub/notes/").view_name == "activitypub:note-list"
def test_create():
assert reverse("activitypub:note-create") == "/activitypub/notes/create/"
assert resolve("/activitypub/notes/create/").view_name == "activitypub:note-create"
def test_note_detail(note: Note):
assert (
reverse("activitypub:note-detail", kwargs={"pk": note.id})
== f"/activitypub/notes/{note.id}/"
)
assert (
resolve(f"/activitypub/notes/{note.id}/").view_name == "activitypub:note-detail"
)
def test_note_reply(note: Note):
assert (
reverse("activitypub:note-reply", kwargs={"pk": note.id})
== f"/activitypub/notes/{note.id}/reply/"
)
assert (
resolve(f"/activitypub/notes/{note.id}/reply/").view_name
== "activitypub:note-reply"
)
def test_note_like(note: Note):
assert (
reverse("activitypub:note-like", kwargs={"pk": note.id})
== f"/activitypub/notes/{note.id}/like/"
)
assert (
resolve(f"/activitypub/notes/{note.id}/like/").view_name
== "activitypub:note-like"
)
def test_note_repost(note: Note):
assert (
reverse("activitypub:note-repost", kwargs={"pk": note.id})
== f"/activitypub/notes/{note.id}/repost/"
)
assert (
resolve(f"/activitypub/notes/{note.id}/repost/").view_name
== "activitypub:note-repost"
)
def test_person_create():
assert reverse("activitypub:person-create") == "/activitypub/person/create/"
assert (
resolve("/activitypub/person/create/").view_name == "activitypub:person-create"
)
def test_person_update():
assert reverse("activitypub:person-update") == "/activitypub/person/update/"
assert (
resolve("/activitypub/person/update/").view_name == "activitypub:person-update"
)
def test_following():
assert reverse("activitypub:following-notes") == "/activitypub/person/following/"
assert (
resolve("/activitypub/person/following/").view_name
== "activitypub:following-notes"
)
def test_person_detail(person: Person):
assert (
reverse("activitypub:person-detail", kwargs={"username": person.display_name})
== f"/activitypub/person/{person.display_name}/"
)
assert (
resolve(f"/activitypub/person/{person.display_name}/").view_name
== "activitypub:person-detail"
)
def test_follow(person: Person):
assert (
reverse("activitypub:person-follow", kwargs={"username": person.display_name})
== f"/activitypub/person/{person.display_name}/follow/"
)
assert (
resolve(f"/activitypub/person/{person.display_name}/follow/").view_name
== "activitypub:person-follow"
)