Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
EPedley committed Sep 12, 2024
1 parent 1121b8f commit b93632f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions api/dataset/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from django.urls import path

from api.user.views import UserActivityLogList

from api.dataset.views import BarrierList, FeedbackDataWorkspaceListView, UserList
from api.user.views import UserActivityLogList

app_name = "dataset"

Expand Down
5 changes: 2 additions & 3 deletions api/dataset/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from datetime import datetime

from dateutil.relativedelta import relativedelta
from django.contrib.auth import get_user_model
from hawkrest import HawkAuthentication
from rest_framework import generics
from rest_framework.permissions import IsAuthenticated

from django.contrib.auth import get_user_model

from api.barriers.models import Barrier
from api.barriers.serializers import DataWorkspaceSerializer
from api.dataset.pagination import MarketAccessDatasetViewCursorPagination
Expand Down Expand Up @@ -63,7 +63,6 @@ class UserList(generics.ListAPIView):
permission_classes = (IsAuthenticated,)

def get_queryset(self):
print("HELLO IM IN THE USER LIST")
login_cutoff = datetime.now() - relativedelta(months=6)
return (
UserModel.objects.all()
Expand Down
9 changes: 4 additions & 5 deletions tests/dataset/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import freezegun
import time_machine
from django.contrib.auth import get_user_model
from mock import PropertyMock, patch
from pytz import UTC
from rest_framework import status
from rest_framework.reverse import reverse
from django.contrib.auth import get_user_model

from api.barriers.models import Barrier
from api.collaboration.models import TeamMember
from api.core.test_utils import APITestMixin, create_test_user, create_simple_user
from api.core.test_utils import APITestMixin, create_simple_user, create_test_user
from api.feedback.models import Feedback
from api.metadata.constants import (
FEEDBACK_FORM_ATTEMPTED_ACTION_ANSWERS,
Expand Down Expand Up @@ -308,13 +308,13 @@ def test_users_added(self):

response1 = response.data["results"][0]["last_login"]
response2 = response.data["results"][1]["last_login"]
# reversing timestamps because they are ordered in reverse
# reversing timestamps because the data is in reverse chronological order
assert datetime.fromisoformat(response1[:-1]) == ts2
assert datetime.fromisoformat(response2[:-1]) == ts1

def test_user_not_added(self):
user1 = create_test_user()

ts = datetime(2024, 1, 1, 0, 0, 0)
with freezegun.freeze_time(ts):
self.api_client.force_login(user1)
Expand All @@ -324,4 +324,3 @@ def test_user_not_added(self):
assert status.HTTP_200_OK == response.status_code

assert len(response.data["results"]) == 0

0 comments on commit b93632f

Please sign in to comment.