-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jkmarx/limit events api response #2944
Changes from 3 commits
480de66
6c54a40
4937ef9
ea47e6d
63e0b94
2b65c5b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,13 +34,17 @@ def get_is_owner(self, data_set): | |
logger.error("Request is missing a user: %s", e) | ||
return False | ||
return user_request == owner | ||
else: | ||
return data_set.is_owner | ||
|
||
def get_public(self, data_set): | ||
try: | ||
data_set.public | ||
except: | ||
is_public = data_set.is_public() | ||
return is_public | ||
else: | ||
return data_set.public | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto: You don't want to do too much in a |
||
|
||
def get_is_clean(self, data_set): | ||
return data_set.is_clean() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -914,7 +914,7 @@ class EventApiV2Tests(APIV2TestCase): | |
def setUp(self): | ||
super(EventApiV2Tests, self).setUp( | ||
api_base_name="events/", | ||
view=EventViewSet.as_view({"get": "list"}) | ||
view=EventViewSet.as_view() | ||
) | ||
|
||
def test_get_event_list_provides_access_control_between_users(self): | ||
|
@@ -952,16 +952,28 @@ def test_get_event_list(self): | |
|
||
get_request = self.factory.get(urljoin(self.url_root, '/')) | ||
get_request.user = self.user | ||
get_response = self.view(get_request).render() | ||
|
||
force_authenticate(get_request, user=self.user) | ||
get_response = self.view(get_request) | ||
self.assertEqual( | ||
json.loads(get_response.content), | ||
get_response.data, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reorder response (api now handles it) |
||
[ | ||
{ | ||
'date_time': date_times[0], | ||
'message': messages[0], | ||
'date_time': date_times[3], | ||
'message': messages[3], | ||
'data_set': DataSetSerializer( | ||
data_sets[0], context={'request': get_request} | ||
data_sets[3], context={'request': get_request} | ||
).data, | ||
'group': None, | ||
'user': UserSerializer(self.user).data, | ||
'type': 'UPDATE', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Originally the type was one of the CRUD verbs, so I'm surprised this isn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... but it looks like it's just being copied from below, so not a new issue... |
||
'sub_type': 'ANALYSIS_CREATION', | ||
'details': {'display_name': display_names[3]} | ||
}, | ||
{ | ||
'date_time': date_times[2], | ||
'message': messages[2], | ||
'data_set': DataSetSerializer( | ||
data_sets[2], context={'request': get_request} | ||
).data, | ||
'group': None, | ||
'user': UserSerializer(self.user).data, | ||
|
@@ -982,27 +994,16 @@ def test_get_event_list(self): | |
'details': {'display_name': display_names[1]} | ||
}, | ||
{ | ||
'date_time': date_times[2], | ||
'message': messages[2], | ||
'date_time': date_times[0], | ||
'message': messages[0], | ||
'data_set': DataSetSerializer( | ||
data_sets[2], context={'request': get_request} | ||
data_sets[0], context={'request': get_request} | ||
).data, | ||
'group': None, | ||
'user': UserSerializer(self.user).data, | ||
'type': 'CREATE', | ||
'sub_type': '', | ||
'details': {} | ||
}, | ||
{ | ||
'date_time': date_times[3], | ||
'message': messages[3], | ||
'data_set': DataSetSerializer( | ||
data_sets[3], context={'request': get_request}).data, | ||
'group': None, | ||
'user': UserSerializer(self.user).data, | ||
'type': 'UPDATE', | ||
'sub_type': 'ANALYSIS_CREATION', | ||
'details': {'display_name': display_names[3]} | ||
} | ||
] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left out else, fixes null response from API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just
return
in the firsttry
? And you could do the same thing in theexcept
: