expose report_usage command behavior as restful api#111
Conversation
Codecov Report
@@ Coverage Diff @@
## master #111 +/- ##
==========================================
+ Coverage 99.4% 99.44% +0.04%
==========================================
Files 26 28 +2
Lines 1169 1258 +89
Branches 73 74 +1
==========================================
+ Hits 1162 1251 +89
Misses 3 3
Partials 4 4
Continue to review full report at Codecov.
|
1ff6297 to
3ce49c4
Compare
cloudigrade/account/reports.py
Outdated
There was a problem hiding this comment.
We should probably use Account.objects.filter(account_id=account_id).exists(), it should be a little faster since we are just checking for the presence of the object. Additionally, maybe we could add if not and throw an exception if the account does not exist?
There was a problem hiding this comment.
If we are testing serializers, shouldn't this come from account.serializers?
3ce49c4 to
b0bb850
Compare
|
|
||
| router = routers.DefaultRouter() | ||
| router.register(r'account', AccountViewSet) | ||
| router.register(r'report', ReportViewSet, base_name='report') |
There was a problem hiding this comment.
Is there a reason for setting the base_name here? It doesn't look like we defined a custom get_queryset method in the ReportViewSet .
There was a problem hiding this comment.
The base_name is necessary because ReportViewSet doesn't have a custom get_queryset or queryset, and I didn't give it a custom get_queryset because I couldn't think of a meaningful queryset to put there since all the fun model work for reporting happens a few steps away in get_hourly_usage.

implements #81