File: test_general.py

package info (click to toggle)
pychurchtools 0.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 408 kB
  • sloc: python: 2,060; makefile: 4
file content (41 lines) | stat: -rw-r--r-- 1,206 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from __future__ import annotations

from uuid import uuid4

from tests import get_ct_client


class TestGeneral:
    @classmethod
    def setup_class(cls):
        cls.ct = get_ct_client()

    def test_config(self):
        assert self.ct.general.config()

    def test_config_update(self):
        new_brand = str(uuid4())
        assert self.ct.general.config_update({"brand": new_brand})
        conf = self.ct.general.config()
        assert conf.brand == new_brand

    def test_info(self):
        assert self.ct.general.info()

    def test_search(self):
        assert self.ct.general.search("Gott")

    def test_simulate(self):
        persons, _ = self.ct.persons.get_all()
        me = self.ct.general.whoami()
        persons_other_than_me = [p for p in persons if p.id != me.id]
        person_to_simulate = persons_other_than_me[0]
        assert self.ct.general.simulate(person_to_simulate.id)
        simulated_me = self.ct.general.whoami()
        assert simulated_me.id == person_to_simulate.id
        assert self.ct.general.simulate_stop()
        new_me = self.ct.general.whoami()
        assert new_me.id == me.id

    def test_whoami(self):
        assert self.ct.general.whoami()