Skip to content

Commit

Permalink
Update verified_at fields to joined_at fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jb3 committed Dec 19, 2020
1 parent e100887 commit eff717b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion postgres/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CREATE DATABASE metricity;

CREATE TABLE users (
id varchar,
verified_at timestamp,
joined_at timestamp,
primary key(id)
);

Expand Down
10 changes: 5 additions & 5 deletions pydis_site/apps/api/tests/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,10 @@ def setUpTestData(cls):

def test_get_metricity_data(self):
# Given
verified_at = "foo"
joined_at = "foo"
total_messages = 1
total_blocks = 1
self.mock_metricity_user(verified_at, total_messages, total_blocks)
self.mock_metricity_user(joined_at, total_messages, total_blocks)

# When
url = reverse('bot:user-metricity-data', args=[0], host='api')
Expand All @@ -419,7 +419,7 @@ def test_get_metricity_data(self):
# Then
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json(), {
"verified_at": verified_at,
"joined_at": joined_at,
"total_messages": total_messages,
"voice_banned": False,
"activity_blocks": total_blocks
Expand Down Expand Up @@ -455,12 +455,12 @@ def test_metricity_voice_banned(self):
self.assertEqual(response.status_code, 200)
self.assertEqual(response.json()["voice_banned"], case["voice_banned"])

def mock_metricity_user(self, verified_at, total_messages, total_blocks):
def mock_metricity_user(self, joined_at, total_messages, total_blocks):
patcher = patch("pydis_site.apps.api.viewsets.bot.user.Metricity")
self.metricity = patcher.start()
self.addCleanup(patcher.stop)
self.metricity = self.metricity.return_value.__enter__.return_value
self.metricity.user.return_value = dict(verified_at=verified_at)
self.metricity.user.return_value = dict(joined_at=joined_at)
self.metricity.total_messages.return_value = total_messages
self.metricity.total_message_blocks.return_value = total_blocks

Expand Down
2 changes: 1 addition & 1 deletion pydis_site/apps/api/viewsets/bot/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class UserViewSet(ModelViewSet):
#### Response format
>>> {
... "verified_at": "2020-10-06T21:54:23.540766",
... "joined_at": "2020-10-06T21:54:23.540766",
... "total_messages": 2,
... "voice_banned": False,
... "activity_blocks": 1
Expand Down

0 comments on commit eff717b

Please sign in to comment.