Skip to content

Commit

Permalink
test(acceptance/os): 🧹 Remove unused fixtures
Browse files Browse the repository at this point in the history
Signed-off-by: Alf-Rune Siqveland <alf.rune@northern.tech>
  • Loading branch information
alfrunes committed May 9, 2024
1 parent 39cd9d4 commit 08bc32b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 58 deletions.
38 changes: 0 additions & 38 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,6 @@ def clean_migrated_db(clean_db, cli):
yield clean_db


@pytest.fixture(scope="function")
def tenant_foobar_clean_migrated_db(clean_db, cli):
"""Clean 'foobar' database with migrations applied. Yields pymongo.MongoClient connected to the DB."""
cli.migrate(tenant="foobar")
yield clean_db


@pytest.fixture(scope="session")
def management_api(request):
yield SimpleManagementClient(
Expand Down Expand Up @@ -232,14 +225,6 @@ def make_fake_tenant_token(tenant):
return "fake." + enc + ".fake-sig"


@pytest.fixture
def tenant_foobar(request, tenant_foobar_clean_migrated_db):
"""Fixture that sets up a tenant with ID 'foobar', on top of a clean migrated
(with tenant support) DB.
"""
return make_fake_tenant_token("foobar")


def make_devices(device_api, devcount=1, tenant_token=""):
url = device_api.auth_requests_url

Expand Down Expand Up @@ -270,29 +255,6 @@ def devices(device_api, clean_migrated_db, request):
yield make_devices(device_api, devcount)


@pytest.fixture(scope="function")
def tenant_foobar_devices(device_api, management_api, tenant_foobar, request):
"""Make unauthorized devices owned by tenant with ID 'foobar'. The fixture can
be parametrized a number of devices to make. Yields a list of tuples:
(instance of Device, instance of DevAuthorizer)
"""
handlers = [
(
"POST",
"/api/internal/v1/tenantadm/tenants/verify",
lambda _: (200, {}, '{"id": "foobar", "plan": "os"}'),
),
]
with mockserver.run_fake(get_fake_tenantadm_addr(), handlers=handlers) as fake:

if not hasattr(request, "param"):
devcount = 1
else:
devcount = int(request.param)

yield make_devices(device_api, devcount, tenant_token=tenant_foobar)


def get_fake_tenantadm_addr():
return os.environ.get("FAKE_TENANTADM_ADDR", "0.0.0.0:9999")

Expand Down
14 changes: 0 additions & 14 deletions tests/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,6 @@
}


@pytest.fixture(scope="function")
def migrated_tenant_dbs(clean_db, mongo):
"""Init a set of tenant dbs to predefined versions."""
for tid, ver in MIGRATED_TENANT_DBS.items():
mongo_set_version(mongo, make_tenant_db(tid), ver)


@pytest.fixture(scope="function")
def migrated_tenant_dbs_with_ids(clean_db, mongo):
"""Init a set of tenant dbs holding just the ids, for listing tenants purpose."""
for tid in TENANT_IDS:
mongo_insert_tenant_data(mongo, DB_NAME, tid)


@pytest.fixture(scope="function")
def fake_migrated_db(clean_db, mongo, request):
"""Init a default db to version passed in 'request'. Does not run the actual
Expand Down
3 changes: 0 additions & 3 deletions tests/tests/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
management_api,
internal_api,
device_api,
tenant_foobar,
tenant_foobar_devices,
tenant_foobar_clean_migrated_db,
)

from cryptutil import compare_keys
Expand Down
3 changes: 0 additions & 3 deletions tests/tests/test_mgnt_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
management_api,
internal_api,
device_api,
tenant_foobar,
tenant_foobar_devices,
tenant_foobar_clean_migrated_db,
get_keypair,
)

Expand Down

0 comments on commit 08bc32b

Please sign in to comment.