|
2 | 2 | import uuid |
3 | 3 |
|
4 | 4 | import factory |
| 5 | +import mock |
5 | 6 | from django.db import connection |
6 | | -from django.test import TestCase |
7 | 7 | from django.test import override_settings |
| 8 | +from django.test import TestCase |
8 | 9 | from django.utils import timezone |
9 | 10 | from facility_profile.models import Facility |
10 | 11 | from facility_profile.models import MyUser |
11 | 12 | from facility_profile.models import SummaryLog |
12 | | -import mock |
13 | | -import pytest |
14 | 13 |
|
15 | 14 | from ..helpers import create_buffer_and_store_dummy_data |
16 | 15 | from ..helpers import create_dummy_store_data |
|
19 | 18 | from morango.errors import MorangoLimitExceeded |
20 | 19 | from morango.models.core import Buffer |
21 | 20 | from morango.models.core import DatabaseIDModel |
| 21 | +from morango.models.core import DatabaseMaxCounter |
22 | 22 | from morango.models.core import InstanceIDModel |
23 | 23 | from morango.models.core import RecordMaxCounter |
24 | 24 | from morango.models.core import RecordMaxCounterBuffer |
25 | 25 | from morango.models.core import Store |
26 | 26 | from morango.models.core import SyncSession |
27 | | -from morango.models.core import DatabaseMaxCounter |
28 | 27 | from morango.models.core import TransferSession |
29 | 28 | from morango.sync.backends.utils import load_backend |
30 | 29 | from morango.sync.context import LocalSessionContext |
|
35 | 34 | from morango.sync.operations import _queue_into_buffer_v1 |
36 | 35 | from morango.sync.operations import _queue_into_buffer_v2 |
37 | 36 | from morango.sync.operations import CleanupOperation |
38 | | -from morango.sync.operations import ReceiverDequeueOperation |
39 | | -from morango.sync.operations import ProducerDequeueOperation |
40 | | -from morango.sync.operations import ReceiverDeserializeOperation |
41 | 37 | from morango.sync.operations import InitializeOperation |
| 38 | +from morango.sync.operations import ProducerDequeueOperation |
42 | 39 | from morango.sync.operations import ProducerQueueOperation |
| 40 | +from morango.sync.operations import ReceiverDequeueOperation |
| 41 | +from morango.sync.operations import ReceiverDeserializeOperation |
43 | 42 | from morango.sync.operations import ReceiverQueueOperation |
44 | 43 | from morango.sync.syncsession import TransferClient |
45 | 44 |
|
@@ -1101,25 +1100,25 @@ def test_successful_deserialization(self): |
1101 | 1100 | self.assert_deserialization() |
1102 | 1101 |
|
1103 | 1102 | def test_deserialization_with_missing_username(self): |
1104 | | - |
| 1103 | + |
1105 | 1104 | self.serialized_user["username"] = "" |
1106 | 1105 |
|
1107 | 1106 | self.serialize_all_to_store() |
1108 | 1107 |
|
1109 | 1108 | _deserialize_from_store(self.profile) |
1110 | 1109 |
|
1111 | 1110 | self.assert_deserialization(user_deserialized=False, log1_deserialized=False, log2_deserialized=False) |
1112 | | - |
| 1111 | + |
1113 | 1112 | def test_deserialization_with_excessively_long_username(self): |
1114 | | - |
| 1113 | + |
1115 | 1114 | self.serialized_user["username"] = "a" * 256 |
1116 | 1115 |
|
1117 | 1116 | self.serialize_all_to_store() |
1118 | 1117 |
|
1119 | 1118 | _deserialize_from_store(self.profile) |
1120 | 1119 |
|
1121 | 1120 | self.assert_deserialization(user_deserialized=False, log1_deserialized=False, log2_deserialized=False) |
1122 | | - |
| 1121 | + |
1123 | 1122 | def test_deserialization_with_invalid_content_id(self): |
1124 | 1123 |
|
1125 | 1124 | self.serialized_log1["content_id"] = "invalid" |
|
0 commit comments