Coverage for modules/box__default/auth/tests/conftest.py: 100%

# Coverage for modules/box__default/auth/tests/conftest.py : 100%

## 11 statements

Hot-keys on this page

r m x p toggle line displays

j k next/prev highlighted chunk

0 (zero) top of page

1 (one) first highlighted chunk

1"""

2 File conftest.py for auth testing contains pytest fixtures that are only in

3 box__default/auth module. Refer to https://docs.pytest.org/en/stable/fixture.html

4 for more details on pytest

5"""

6 import pytest

7

8

9@pytest.fixture

10 def email_config(request, flask_app):

11 """

12 pytest fixture for temporally changing the email related configs

13 To remove the config pass "remove" in @pytest.parameterize. For

14 setting value to the config pass the actual value. See test_email.py

15 for usage

16

17 Args:

18 request (pytest obj): a built in by pytest object used to read

19 incoming fixture arguments

20 flask_app (flask app): flask app fixture

21

22 """

23 config_name, config_val = request.param

24 old = flask_app.config[config_name]

25

26 if config_val == "remove":

27 del flask_app.config[config_name]

28 else:

29 flask_app.config[config_name] = config_val

30 print(f"\n{config_name}: {config_val}\n")

31

32 yield

33 flask_app.config[config_name] = old