Skip to content

Commit 64de598

Browse files
Tomas-PytelTomas-Pytel
authored andcommitted
Add tests for feature flags: wip
1 parent 069f30f commit 64de598

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

tests/__init__.py

Whitespace-only changes.

tests/conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import pytest
2+
import sys
3+
from pathlib import Path
4+
5+
sys.path.append(str(Path(".").absolute().parent))
6+
7+
from fastapi_featureflags import FeatureFlags
8+
9+
10+
@pytest.fixture(scope="module")
11+
def featureflags():
12+
return FeatureFlags()

tests/features.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"json_only": false,
3+
"ps": true,
4+
"mam": false,
5+
"ror": true,
6+
"dd": true
7+
}

tests/pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
addopts = -p no:warnings -s --tb=no --show-capture=no --log-level=error

tests/test_1.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from fastapi_featureflags import FeatureFlags
2+
3+
4+
def test_ff_1():
5+
ff = FeatureFlags(conf_from_json="tests/features.json")
6+
assert type(ff.get_features()) is dict
7+
assert ff.get_features() == {'json_only': False, 'ps': True, 'mam': False, 'ror': True, 'dd': True}

0 commit comments

Comments
 (0)