parent
c9892b454c
commit
73d02e862a
11 changed files with 107 additions and 55 deletions
@ -1,6 +1,6 @@ |
|||||||
import pytest |
import pytest |
||||||
|
|
||||||
from factories.users import UserFactory, AccountFactory |
from access.factories import UserFactory, AccountFactory |
||||||
|
|
||||||
from access import groups |
from access import groups |
||||||
|
|
||||||
@ -1,6 +1,6 @@ |
|||||||
import pytest |
import pytest |
||||||
|
|
||||||
from factories.courses import CourseFactory, LessonFactory, TopicFactory |
from courses.factories import CourseFactory, LessonFactory, TopicFactory |
||||||
|
|
||||||
|
|
||||||
@pytest.fixture |
@pytest.fixture |
||||||
@ -0,0 +1,58 @@ |
|||||||
|
import os |
||||||
|
import shutil |
||||||
|
|
||||||
|
import pytest |
||||||
|
|
||||||
|
from tests.client import BetterAPIClient |
||||||
|
|
||||||
|
pytest_plugins = [ |
||||||
|
'access.tests.fixtures', |
||||||
|
'finance.tests.fixtures', |
||||||
|
'courses.tests.fixtures' |
||||||
|
] |
||||||
|
|
||||||
|
|
||||||
|
def pytest_sessionfinish(session, exitstatus): |
||||||
|
""" whole test run finishes. """ |
||||||
|
print('pytest finish: cleanup') |
||||||
|
if os.path.exists('media_qa'): |
||||||
|
shutil.rmtree('media_qa') |
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture |
||||||
|
def api_client(): |
||||||
|
"""Anonymous client for REST API.""" |
||||||
|
client = BetterAPIClient() |
||||||
|
return client |
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture |
||||||
|
def admin_client(admin): |
||||||
|
"""Authorized as admin(superuser) client for REST API.""" |
||||||
|
client = BetterAPIClient() |
||||||
|
client.force_authenticate(user=admin) |
||||||
|
return client |
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture |
||||||
|
def student_client(student): |
||||||
|
"""Authorized as student client for REST API.""" |
||||||
|
client = BetterAPIClient() |
||||||
|
client.force_authenticate(user=student) |
||||||
|
return client |
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture |
||||||
|
def manager_client(manager): |
||||||
|
"""Authorized as manager client for REST API.""" |
||||||
|
client = BetterAPIClient() |
||||||
|
client.force_authenticate(user=manager) |
||||||
|
return client |
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture |
||||||
|
def lead_manager_client(lead_manager): |
||||||
|
"""Authorized as lead manager client for REST API.""" |
||||||
|
client = BetterAPIClient() |
||||||
|
client.force_authenticate(user=lead_manager) |
||||||
|
return client |
||||||
@ -1,7 +1,7 @@ |
|||||||
import pytest |
import pytest |
||||||
from yandex_money.models import Payment |
from yandex_money.models import Payment |
||||||
|
|
||||||
from factories.finance import BillFactory, InvoiceFactory, PaymentFactory |
from finance.factories import BillFactory, InvoiceFactory, PaymentFactory |
||||||
|
|
||||||
PRICE = 1000.00 |
PRICE = 1000.00 |
||||||
METHOD_CASH = 'C' |
METHOD_CASH = 'C' |
||||||
Loading…
Reference in new issue