aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/tests
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2021-11-26 20:27:48 +0100
committerGravatar GitHub <[email protected]>2021-11-26 20:27:48 +0100
commitd86f71448225d0c7937f05f5c1c5508199415f4d (patch)
tree03a1c6106dc6cbdee20c08402051e84aa0153339 /pydis_site/apps/api/tests
parentAdds Redirects To Static Builds (diff)
parentMerge pull request #621 from python-discord/add-dm_sent-field (diff)
Merge branch 'main' into redirects
Diffstat (limited to 'pydis_site/apps/api/tests')
-rw-r--r--pydis_site/apps/api/tests/test_off_topic_channel_names.py2
-rw-r--r--pydis_site/apps/api/tests/test_offensive_message.py2
-rw-r--r--pydis_site/apps/api/tests/test_users.py23
3 files changed, 23 insertions, 4 deletions
diff --git a/pydis_site/apps/api/tests/test_off_topic_channel_names.py b/pydis_site/apps/api/tests/test_off_topic_channel_names.py
index 63993978..1825f6e6 100644
--- a/pydis_site/apps/api/tests/test_off_topic_channel_names.py
+++ b/pydis_site/apps/api/tests/test_off_topic_channel_names.py
@@ -154,7 +154,7 @@ class DeletionTests(AuthenticatedAPITestCase):
cls.test_name_2 = OffTopicChannelName.objects.create(name='bbq-with-bisk')
def test_deleting_unknown_name_returns_404(self):
- """Return 404 reponse when trying to delete unknown name."""
+ """Return 404 response when trying to delete unknown name."""
url = reverse('api:bot:offtopicchannelname-detail', args=('unknown-name',))
response = self.client.delete(url)
diff --git a/pydis_site/apps/api/tests/test_offensive_message.py b/pydis_site/apps/api/tests/test_offensive_message.py
index 9b79b38c..3cf95b75 100644
--- a/pydis_site/apps/api/tests/test_offensive_message.py
+++ b/pydis_site/apps/api/tests/test_offensive_message.py
@@ -58,7 +58,7 @@ class CreationTests(AuthenticatedAPITestCase):
)
for field, invalid_value in cases:
- with self.subTest(fied=field, invalid_value=invalid_value):
+ with self.subTest(field=field, invalid_value=invalid_value):
test_data = data.copy()
test_data.update({field: invalid_value})
diff --git a/pydis_site/apps/api/tests/test_users.py b/pydis_site/apps/api/tests/test_users.py
index 295bcf64..81bfd43b 100644
--- a/pydis_site/apps/api/tests/test_users.py
+++ b/pydis_site/apps/api/tests/test_users.py
@@ -408,7 +408,7 @@ class UserMetricityTests(AuthenticatedAPITestCase):
in_guild=True,
)
- def test_get_metricity_data(self):
+ def test_get_metricity_data_under_1k(self):
# Given
joined_at = "foo"
total_messages = 1
@@ -421,13 +421,32 @@ class UserMetricityTests(AuthenticatedAPITestCase):
# Then
self.assertEqual(response.status_code, 200)
- self.assertEqual(response.json(), {
+ self.assertCountEqual(response.json(), {
"joined_at": joined_at,
"total_messages": total_messages,
"voice_banned": False,
"activity_blocks": total_blocks
})
+ def test_get_metricity_data_over_1k(self):
+ # Given
+ joined_at = "foo"
+ total_messages = 1001
+ total_blocks = 1001
+ self.mock_metricity_user(joined_at, total_messages, total_blocks, [])
+
+ # When
+ url = reverse('api:bot:user-metricity-data', args=[0])
+ response = self.client.get(url)
+
+ # Then
+ self.assertEqual(response.status_code, 200)
+ self.assertCountEqual(response.json(), {
+ "joined_at": joined_at,
+ "total_messages": total_messages,
+ "voice_banned": False,
+ })
+
def test_no_metricity_user(self):
# Given
self.mock_no_metricity_user()