File: persistence_test.py

package info (click to toggle)
errbot 6.1.7%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 3,712 kB
  • sloc: python: 13,831; makefile: 164; sh: 97
file content (20 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from errbot.storage import StoreMixin
from errbot.storage.memory import MemoryStoragePlugin


def test_simple_store_retreive():
    sm = StoreMixin()
    sm.open_storage(MemoryStoragePlugin(None), "ns")
    sm["toto"] = "titui"
    assert sm["toto"] == "titui"


def test_mutable():
    sm = StoreMixin()
    sm.open_storage(MemoryStoragePlugin(None), "ns")
    sm["toto"] = [1, 3]

    with sm.mutable("toto") as titi:
        titi[1] = 5

    assert sm["toto"] == [1, 5]