|
1 | 1 | Dev Setup |
2 | 2 | ======== |
3 | 3 |
|
4 | | -Installation |
5 | | -Dependencies |
| 4 | +Before getting started, ensure you have the following dependencies installed: |
6 | 5 |
|
7 | | -Tests |
8 | | -SQLite |
9 | | -Postgres |
10 | | -Integrationtest->Kolibri |
| 6 | +- ``python`` (2.7 or 3.6 - 3.11) |
| 7 | +- ``swig`` |
| 8 | +- ``openssl`` |
| 9 | +- ``docker-compose`` (for testing against postgres backends) |
11 | 10 |
|
12 | | -Soft-deletion |
13 | | -------------- |
| 11 | +Optionally create a virtual environment with your Python setup for this project, then run the following commands:: |
14 | 12 |
|
15 | | -Typically, deletion merely hides records, rather than actually erasing data. |
| 13 | + pip install -r requirements/dev.txt |
| 14 | + pip install -r requirements/test.txt |
| 15 | + # for testing with postgres: this might require a local install of a postgres package |
| 16 | + pip install -r requirements/postgres.txt |
16 | 17 |
|
17 | | -When a record for a subclass of ``SyncableModel`` is deleted, its ID is added to the ``DeletedModels`` table. When a subsequent serialization occurs, this information is used to turn on the ``deleted`` flag in the store for that record. When syncing with other Morango instances, the soft deletion will propagate to the store record of other instances. |
18 | 18 |
|
19 | | -This is considered a "soft-delete" in the store because the data is not actually cleared. |
| 19 | +Testing |
| 20 | +------- |
20 | 21 |
|
| 22 | +Tests can be launched as follows:: |
21 | 23 |
|
22 | | -Hard-deletion |
23 | | -------------- |
| 24 | + make test |
| 25 | + # launch against a postgres backend |
| 26 | + make test-with-postgres |
24 | 27 |
|
25 | | -There are times, such as GDPR removal requests, when it's necessary to actually to erase data. |
26 | | - |
27 | | -This is handled using a ``HardDeletedModels`` table. Subclasses of ``SyncableModel`` should override the ``delete`` method to take a ``hard_delete`` boolean, and add the record to the ``HardDeletedModels`` table when this is passed. |
28 | | - |
29 | | -On serialization, Morango clears the ``serialized`` field entry in the store for records in ``HardDeletedModels`` and turns on the ``hard_deleted`` flag. Upon syncing with other Morango instances, the hard deletion will propagate to the store record of other instances. |
| 28 | +The integration tests can be found in the `Kolibri repository <https://github.com/learningequality/kolibri/blob/develop/kolibri/core/auth/test/test_morango_integration.py>`_. |
30 | 29 |
|
0 commit comments