mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Apply code suggestions from @stumpylog
This commit is contained in:
parent
35ca2195fe
commit
93fab8bb95
@ -735,7 +735,7 @@ class MailAccountSerializer(serializers.ModelSerializer):
|
||||
|
||||
class AccountField(serializers.PrimaryKeyRelatedField):
|
||||
def get_queryset(self):
|
||||
return MailAccount.objects.all()
|
||||
return MailAccount.objects.all().order_by("-id")
|
||||
|
||||
|
||||
class MailRuleSerializer(serializers.ModelSerializer):
|
||||
|
@ -2968,15 +2968,11 @@ class TestAPIMailAccounts(APITestCase):
|
||||
self.assertEqual(response.data["count"], 1)
|
||||
returned_account1 = response.data["results"][0]
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
pprint(returned_account1)
|
||||
|
||||
self.assertEqual(returned_account1["name"], account1.name)
|
||||
self.assertEqual(returned_account1["username"], account1.username)
|
||||
self.assertEqual(
|
||||
returned_account1["password"],
|
||||
re.sub(".", "*", account1.password),
|
||||
"*" * len(account1.password),
|
||||
)
|
||||
self.assertEqual(returned_account1["imap_server"], account1.imap_server)
|
||||
self.assertEqual(returned_account1["imap_port"], account1.imap_port)
|
||||
@ -3010,10 +3006,6 @@ class TestAPIMailAccounts(APITestCase):
|
||||
|
||||
returned_account1 = MailAccount.objects.get(name="Email1")
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
pprint(returned_account1)
|
||||
|
||||
self.assertEqual(returned_account1.name, account1["name"])
|
||||
self.assertEqual(returned_account1.username, account1["username"])
|
||||
self.assertEqual(returned_account1.password, account1["password"])
|
||||
@ -3150,10 +3142,6 @@ class TestAPIMailRules(APITestCase):
|
||||
self.assertEqual(response.data["count"], 1)
|
||||
returned_rule1 = response.data["results"][0]
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
pprint(returned_rule1)
|
||||
|
||||
self.assertEqual(returned_rule1["name"], rule1.name)
|
||||
self.assertEqual(returned_rule1["account"], account1.pk)
|
||||
self.assertEqual(returned_rule1["folder"], rule1.folder)
|
||||
@ -3239,10 +3227,6 @@ class TestAPIMailRules(APITestCase):
|
||||
self.assertEqual(response.data["count"], 1)
|
||||
returned_rule1 = response.data["results"][0]
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
pprint(returned_rule1)
|
||||
|
||||
self.assertEqual(returned_rule1["name"], rule1["name"])
|
||||
self.assertEqual(returned_rule1["account"], account1.pk)
|
||||
self.assertEqual(returned_rule1["folder"], rule1["folder"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user