-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* FEAT added count endpoint * Fixed bug in count endpoint when no filters have been provided * Fixed helper tests * FEAT made test for count endpoint * FEAT added possibility to join in count filters * FEAT added the possibility to create complex filters in count endpoint. By adding the possibility to expand and filter on expanded objects * Removed commented out code
- Loading branch information
Showing
5 changed files
with
200 additions
and
22 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,23 @@ | ||
from hashtopolis import HashType | ||
from utils import BaseTest | ||
|
||
|
||
class CountTest(BaseTest): | ||
model_class = HashType | ||
|
||
def create_test_objects(self, **kwargs): | ||
objs = [] | ||
for i in range(90000, 90100, 10): | ||
obj = HashType(hashTypeId=i, | ||
description=f"Dummy HashType {i}", | ||
isSalted=(i < 90050), | ||
isSlowHash=False).save() | ||
objs.append(obj) | ||
self.delete_after_test(obj) | ||
return objs | ||
|
||
def test_count(self): | ||
model_objs = self.create_test_objects() | ||
model_count = len(model_objs) | ||
api_count = HashType.objects.count(hashTypeId__gte=90000, hashTypeId__lte=91000)['count'] | ||
self.assertEqual(model_count, api_count) |
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