|
2 | 2 | Sanity checks (mostly) if the admin resources are available |
3 | 3 | """ |
4 | 4 |
|
5 | | -from core.models import DiscordMessage, PretalxData, Webhook |
| 5 | +from core.models import DiscordMessage, PretalxData, PretixData, Webhook |
6 | 6 |
|
7 | 7 |
|
8 | 8 | def test_admin_for_webhooks_sanity_check(admin_client): |
@@ -34,33 +34,69 @@ def test_admin_for_discordmessages_sanity_check(admin_client): |
34 | 34 | assert dm.channel_name.encode() in response.content |
35 | 35 |
|
36 | 36 |
|
37 | | -def test_admin_list_for_pretalx_data(admin_client): |
38 | | - """Simple sanity check if the page loads correctly""" |
39 | | - url = "/admin/core/pretalxdata/" |
40 | | - pd = PretalxData.objects.create( |
41 | | - resource=PretalxData.PretalxResources.speakers, |
42 | | - content={}, |
43 | | - ) |
44 | | - assert pd.uuid |
45 | | - |
46 | | - response = admin_client.get(url) |
47 | | - |
48 | | - assert response.status_code == 200 |
49 | | - assert str(pd.uuid).encode() in response.content |
50 | | - assert pd.get_resource_display().encode() in response.content |
51 | | - |
52 | | - |
53 | | -def test_admin_change_for_pretalx_data(admin_client): |
54 | | - """Simple sanity check if the page loads correctly""" |
55 | | - url = "/admin/core/pretalxdata/" |
56 | | - pd = PretalxData.objects.create( |
57 | | - resource=PretalxData.PretalxResources.speakers, |
58 | | - content={}, |
59 | | - ) |
60 | | - assert pd.uuid |
61 | | - |
62 | | - response = admin_client.get(f"{url}{pd.pk}/change/") |
63 | | - |
64 | | - assert response.status_code == 200 |
65 | | - assert str(pd.uuid).encode() in response.content |
66 | | - assert pd.get_resource_display().encode() in response.content |
| 37 | +class TestPretalxDataAdmin: |
| 38 | + """This class exists only for namespacing purposes""" |
| 39 | + |
| 40 | + def test_admin_list_for_pretalx_data(self, admin_client): |
| 41 | + """Simple sanity check if the page loads correctly""" |
| 42 | + url = "/admin/core/pretalxdata/" |
| 43 | + pd = PretalxData.objects.create( |
| 44 | + resource=PretalxData.PretalxResources.speakers, |
| 45 | + content={}, |
| 46 | + ) |
| 47 | + assert pd.uuid |
| 48 | + |
| 49 | + response = admin_client.get(url) |
| 50 | + |
| 51 | + assert response.status_code == 200 |
| 52 | + assert str(pd.uuid).encode() in response.content |
| 53 | + assert pd.get_resource_display().encode() in response.content |
| 54 | + |
| 55 | + def test_admin_change_for_pretalx_data(self, admin_client): |
| 56 | + """Simple sanity check if the page loads correctly""" |
| 57 | + url = "/admin/core/pretalxdata/" |
| 58 | + pd = PretalxData.objects.create( |
| 59 | + resource=PretalxData.PretalxResources.speakers, |
| 60 | + content={}, |
| 61 | + ) |
| 62 | + assert pd.uuid |
| 63 | + |
| 64 | + response = admin_client.get(f"{url}{pd.pk}/change/") |
| 65 | + |
| 66 | + assert response.status_code == 200 |
| 67 | + assert str(pd.uuid).encode() in response.content |
| 68 | + assert pd.get_resource_display().encode() in response.content |
| 69 | + |
| 70 | + |
| 71 | +class TestPretixDataAdmin: |
| 72 | + """This class exists only for namespacing purposes""" |
| 73 | + |
| 74 | + def test_admin_list_for_pretix_data(self, admin_client): |
| 75 | + """Simple sanity check if the page loads correctly""" |
| 76 | + url = "/admin/core/pretixdata/" |
| 77 | + pd = PretixData.objects.create( |
| 78 | + resource=PretixData.PretixResources.orders, |
| 79 | + content={}, |
| 80 | + ) |
| 81 | + assert pd.uuid |
| 82 | + |
| 83 | + response = admin_client.get(url) |
| 84 | + |
| 85 | + assert response.status_code == 200 |
| 86 | + assert str(pd.uuid).encode() in response.content |
| 87 | + assert pd.get_resource_display().encode() in response.content |
| 88 | + |
| 89 | + def test_admin_change_for_pretix_data(self, admin_client): |
| 90 | + """Simple sanity check if the page loads correctly""" |
| 91 | + url = "/admin/core/pretixdata/" |
| 92 | + pd = PretixData.objects.create( |
| 93 | + resource=PretixData.PretixResources.orders, |
| 94 | + content={}, |
| 95 | + ) |
| 96 | + assert pd.uuid |
| 97 | + |
| 98 | + response = admin_client.get(f"{url}{pd.pk}/change/") |
| 99 | + |
| 100 | + assert response.status_code == 200 |
| 101 | + assert str(pd.uuid).encode() in response.content |
| 102 | + assert pd.get_resource_display().encode() in response.content |
0 commit comments