finished admin_stats endpoint

This commit is contained in:
Sam
2021-03-12 12:14:30 +00:00
parent 712cabe3da
commit d0609fd1fa
4 changed files with 36 additions and 3 deletions

View File

@@ -702,6 +702,7 @@ class AdminStatsTest(APITestCase):
# Assert access is forbidden
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
# admin user
def test_admin_can_get_data(self):
# make user admin
self.user.is_staff = True
@@ -714,7 +715,7 @@ class AdminStatsTest(APITestCase):
response = self.client.get(self.endpoint)
self.assertEquals(response.status_code, 200)
payload = response.json()
expected_entries = ['company_count', 'product_count', 'companies_per_region', 'products_per_region']
expected_entries = ['company_count', 'product_count', 'companies_per_region', 'products_per_region', 'companies_timeline', 'products_timeline', 'users_timeline', 'contact_timeline', 'shopping_timeline']
for name in expected_entries:
self.assertTrue(name in payload)