-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9acec66
commit e6c63c8
Showing
7 changed files
with
166 additions
and
33 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
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,35 @@ | ||
from file.export import XLS, JSON, CSV | ||
from file.services import StatsServices | ||
from django.test import TestCase | ||
from attribute.attribute_tests.mock_attribute import MockCase | ||
from json import loads | ||
|
||
|
||
class ExportTest(TestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.case = MockCase() | ||
cls.attr_stat, _ = StatsServices.from_attribute(cls.case.project.id) | ||
cls.user_stat, _ = StatsServices.from_user(cls.case.project.id) | ||
|
||
def test_xls(self): | ||
attr_res = XLS(self.attr_stat, "attribute").into_response() | ||
user_res = XLS(self.user_stat, "user").into_response() | ||
# TODO: | ||
|
||
def test_csv(self): | ||
attr_res = CSV(self.attr_stat, "attribute").into_response() | ||
user_res = CSV(self.user_stat, "user").into_response() | ||
|
||
attributes = attr_res.read().decode().split("\n") | ||
users = user_res.read().decode().split("\n") | ||
|
||
self.assertTrue(len(attributes) == len(users) == 3) | ||
# TODO: | ||
|
||
def test_json(self): | ||
attr_res = JSON(self.attr_stat, 0).into_response() | ||
user_res = JSON(self.user_stat, 0).into_response() | ||
self.assertEqual(self.attr_stat, loads(attr_res.read().decode())) | ||
self.assertEqual(self.user_stat, loads(user_res.read().decode())) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ pycparser==2.21 | |
python-jose==3.3.0 | ||
rsa==4.9 | ||
six==1.16.0 | ||
XlsxWriter==3.2.0 |
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