Skip to content

Commit f1fce82

Browse files
authored
Merge pull request #176 from mekanix/fix-sql
Simplify project generation
2 parents 389a662 + 4bb7407 commit f1fce82

File tree

8 files changed

+11
-15
lines changed

8 files changed

+11
-15
lines changed

alembic/README

Lines changed: 0 additions & 1 deletion
This file was deleted.

bin/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ export FREENIT_ENV="test"
66

77

88
setup
9-
pytest -v -rs --ignore=freenit/project/
9+
pytest -v --ignore=freenit/project/

freenit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.15"
1+
__version__ = "0.3.16"

freenit/cli.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import os
22
import pathlib
33
import subprocess
4-
5-
from prompt_toolkit import prompt
4+
import sys
65

76

87
def main():
8+
if len(sys.argv) != 2:
9+
raise ValueError(f"Usage: {sys.argv[0]}: <project name>")
10+
project_name = sys.argv[1]
911
path = pathlib.Path(__file__).parent.resolve()
10-
project_name = prompt("Name of the project: ")
1112
executable = f"{path}/../bin/freenit.sh"
1213
if not os.path.exists(executable):
1314
executable = f"{path}/bin/freenit.sh"

freenit/models/ldap/group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async def get_all(cls, domain):
5050
client = get_client()
5151
try:
5252
async with client.connect(is_async=True) as conn:
53-
dn = config.ldap.groupBase.format(domain)
53+
dn = config.ldap.roleBase.format(domain)
5454
res = await conn.search(dn, LDAPSearchScope.SUB, f"(|{classes})")
5555
data = []
5656
for gdata in res:

migrate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99

1010
def db_setup():
11-
importlib.import_module(f"{app_name}.app")
11+
app = importlib.import_module(f"{app_name}.app")
1212
command.upgrade(alembic_cfg, "head")
13+
return app
1314

1415

1516
if __name__ == "__main__":

pytest.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/conftest.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import importlib
21
import os
32

43
import pytest
54

6-
from alembic import command
75
from alembic.config import Config
8-
from name import app_name
6+
from migrate import db_setup as dbs
97

108
from .client import Client
119

@@ -16,8 +14,7 @@
1614

1715
@pytest.fixture
1816
def db_setup():
19-
app = importlib.import_module(f"{app_name}.app")
20-
command.upgrade(alembic_cfg, "head")
17+
app = dbs()
2118

2219
yield app.app
2320

0 commit comments

Comments
 (0)