-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from openimis/feature/fix-primary-op-report
feature/fix-primary-operational-reports
- Loading branch information
Showing
7 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from core.test_helpers import create_test_interactive_user | ||
from rest_framework import status | ||
from rest_framework.test import APITestCase | ||
from dataclasses import dataclass | ||
from graphql_jwt.shortcuts import get_token | ||
from core.models import User | ||
from django.conf import settings | ||
|
||
|
||
@dataclass | ||
class DummyContext: | ||
""" Just because we need a context to generate. """ | ||
user: User | ||
|
||
|
||
class ReportAPITests( APITestCase): | ||
|
||
admin_user = None | ||
admin_token = None | ||
POI_URL = f'/{settings.SITE_ROOT()}report/policy_primary_operational_indicators/pdf/?yearMonth=2019-04-01' | ||
PR_URL = f'/{settings.SITE_ROOT()}report/policy_renewals/pdf/?date_start=2019-04-01&date_end=2019-04-30' | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.admin_user = create_test_interactive_user(username="testLocationAdmin") | ||
cls.admin_token = get_token(cls.admin_user, DummyContext(user=cls.admin_user)) | ||
|
||
def test_primary_operational_indicators_report(self): | ||
headers={"HTTP_AUTHORIZATION": f"Bearer {self.admin_token}"} | ||
response = self.client.get(self.POI_URL, format='json', **headers) | ||
self.assertEqual(response.status_code, status.HTTP_200_OK) | ||
|
||
def test_policy_renewal_report(self): | ||
headers={"HTTP_AUTHORIZATION": f"Bearer {self.admin_token}"} | ||
response = self.client.get(self.PR_URL, format='json', **headers) | ||
self.assertEqual(response.status_code, status.HTTP_200_OK) |