Add tests for device statistics
Add test cases for device stats, device report history, device update
history and downloading log files.
Issue: HIC-188
Change-Id: I1c9777fadf12c210d1e564c9ff1718afb9ea7f23
diff --git a/crashreports/permissions.py b/crashreports/permissions.py
index dd405ec..4ee567d 100644
--- a/crashreports/permissions.py
+++ b/crashreports/permissions.py
@@ -4,6 +4,7 @@
from django.core.exceptions import ObjectDoesNotExist
from rest_framework.permissions import BasePermission
from crashreports.models import Device
+from hiccup.allauth_adapters import FP_STAFF_GROUP_NAME
def user_owns_uuid(user, uuid):
@@ -44,7 +45,7 @@
Returns: True if user is part of the Hiccup staff.
"""
- if user.groups.filter(name="FairphoneSoftwareTeam").exists():
+ if user.groups.filter(name=FP_STAFF_GROUP_NAME).exists():
return True
return user.has_perms(
[
@@ -93,7 +94,9 @@
# Security requirements for swagger documentation
SWAGGER_SECURITY_REQUIREMENTS_OAUTH = [{"Google OAuth": []}]
-SWAGGER_SECURITY_REQUIREMENTS_DEVICE_TOKEN = [{"Device token authentication": []}]
+SWAGGER_SECURITY_REQUIREMENTS_DEVICE_TOKEN = [
+ {"Device token authentication": []}
+]
SWAGGER_SECURITY_REQUIREMENTS_ALL = (
SWAGGER_SECURITY_REQUIREMENTS_OAUTH
+ SWAGGER_SECURITY_REQUIREMENTS_DEVICE_TOKEN