id
int64
0
458k
file_name
stringlengths
4
119
file_path
stringlengths
14
227
content
stringlengths
24
9.96M
size
int64
24
9.96M
language
stringclasses
1 value
extension
stringclasses
14 values
total_lines
int64
1
219k
avg_line_length
float64
2.52
4.63M
max_line_length
int64
5
9.91M
alphanum_fraction
float64
0
1
repo_name
stringlengths
7
101
repo_stars
int64
100
139k
repo_forks
int64
0
26.4k
repo_open_issues
int64
0
2.27k
repo_license
stringclasses
12 values
repo_extraction_date
stringclasses
433 values
25,200
test_pool_dataset_unlock_restart_vms.py
truenas_middleware/tests/api2/test_pool_dataset_unlock_restart_vms.py
import pytest from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call, mock, ssh PASSPHRASE = "12345678" def encryption_props(): return { "encryption_options": {"generate_key": False, "passphrase": PASSPHRASE}, "encryption": True, ...
2,042
Python
.py
46
29.217391
83
0.468246
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,201
test_catalogs.py
truenas_middleware/tests/api2/test_catalogs.py
import os.path import pytest from middlewared.test.integration.assets.pool import another_pool from middlewared.test.integration.utils import call from middlewared.test.integration.utils.docker import IX_APPS_CATALOG_PATH @pytest.fixture(scope='module') def docker_pool(request): with another_pool() as pool: ...
2,629
Python
.py
56
43.482143
85
0.727094
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,202
test_account_ssh_key.py
truenas_middleware/tests/api2/test_account_ssh_key.py
from middlewared.test.integration.assets.account import user from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call, ssh def test_account_create_update_ssh_key_in_existing_dir(): with dataset("home") as ds: homedir = f"/mnt/{ds}" with user(...
2,352
Python
.py
65
24.876923
85
0.489661
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,203
test_network_configuration.py
truenas_middleware/tests/api2/test_network_configuration.py
from middlewared.test.integration.utils import call, ssh from auto_config import ha NEW_HOSTNAME = 'dummy123' def fetch_hostname(): name = ssh('hostname').strip() if ha: return name.removesuffix('-nodea').removesuffix('-nodeb') return name def config_read_hostname(): config = call('network...
1,010
Python
.py
30
27.166667
65
0.656347
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,204
test_iscsi_target_crud_roles.py
truenas_middleware/tests/api2/test_iscsi_target_crud_roles.py
import pytest from middlewared.test.integration.assets.roles import common_checks @pytest.mark.parametrize("role", ["SHARING_READ", "SHARING_ISCSI_READ", "SHARING_ISCSI_TARGET_READ"]) def test_read_role_can_read(unprivileged_user_fixture, role): common_checks(unprivileged_user_fixture, "iscsi.target.query", role...
1,178
Python
.py
15
75.2
106
0.771626
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,205
test_user_ssh_password.py
truenas_middleware/tests/api2/test_user_ssh_password.py
import pytest from middlewared.test.integration.assets.account import user, group from middlewared.test.integration.utils import call, ssh @pytest.mark.parametrize("ssh_password_enabled", [True, False]) def test_user_ssh_password_enabled(ssh_password_enabled): with user({ "username": "test", "ful...
1,614
Python
.py
40
32.2
93
0.615581
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,206
test_ftp_crud_roles.py
truenas_middleware/tests/api2/test_ftp_crud_roles.py
import pytest from middlewared.test.integration.assets.roles import common_checks @pytest.mark.parametrize("role", ["SHARING_READ", "SHARING_FTP_READ"]) def test_read_role_can_read(unprivileged_user_fixture, role): common_checks(unprivileged_user_fixture, "ftp.config", role, True, valid_role_exception=False) ...
1,395
Python
.py
24
53.5
113
0.73607
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,207
test_websocket_interface.py
truenas_middleware/tests/api2/test_websocket_interface.py
from auto_config import interface from middlewared.test.integration.utils import call def test_websocket_interface(): """This tests to ensure we return the interface name by which the websocket connection has been established.""" assert call("interface.websocket_interface")["id"] == interface
308
Python
.py
6
48
67
0.783333
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,208
test_apps_images_roles.py
truenas_middleware/tests/api2/test_apps_images_roles.py
import pytest from middlewared.test.integration.assets.roles import common_checks @pytest.mark.parametrize('method, role, valid_role, valid_role_exception', ( ('app.image.query', 'APPS_READ', True, False), ('app.image.query', 'APPS_WRITE', True, False), ('app.image.query', 'DOCKER_READ', False, False), ...
739
Python
.py
13
53.153846
113
0.70816
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,209
test_435_smb_registry.py
truenas_middleware/tests/api2/test_435_smb_registry.py
import contextlib import os import pytest from middlewared.service_exception import ValidationError from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.assets.smb import smb_share from middlewared.test.integration.utils import call, ssh DATASET_NAME = 'smb-reg' SHARES = [f'R...
13,341
Python
.py
334
33.730539
199
0.646604
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,210
test_475_syslog.py
truenas_middleware/tests/api2/test_475_syslog.py
from time import sleep import pytest from auto_config import password, user from middlewared.test.integration.utils import call, ssh from middlewared.test.integration.utils.client import truenas_server def do_syslog(ident, message, facility='syslog.LOG_USER', priority='syslog.LOG_INFO'): """ This generates ...
3,214
Python
.py
84
32.154762
106
0.651267
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,211
test_040_ad_user_group_cache.py
truenas_middleware/tests/api2/test_040_ad_user_group_cache.py
#!/usr/bin/env python3 import errno import pytest import sys import os apifolder = os.getcwd() sys.path.append(apifolder) from functions import SSH_TEST from auto_config import password, user from middlewared.service_exception import CallError from middlewared.test.integration.assets.directory_service import active_di...
6,632
Python
.py
151
37.933775
89
0.645924
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,212
test_account_privilege_role_private_fields.py
truenas_middleware/tests/api2/test_account_privilege_role_private_fields.py
import contextlib import pytest from middlewared.test.integration.assets.account import unprivileged_user_client from middlewared.test.integration.assets.api_key import api_key from middlewared.test.integration.assets.cloud_backup import task as cloud_backup_task from middlewared.test.integration.assets.cloud_sync im...
6,965
Python
.py
190
28.515789
112
0.58737
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,213
test_audit_sudo.py
truenas_middleware/tests/api2/test_audit_sudo.py
import contextlib import secrets import string import time import pytest from middlewared.test.integration.assets.account import user from middlewared.test.integration.utils import call, ssh from middlewared.test.integration.utils.time_utils import utc_now from datetime import timezone EVENT_KEYS = {'timestamp', 'mes...
10,729
Python
.py
223
40.053812
186
0.631942
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,214
test_snapshot_query.py
truenas_middleware/tests/api2/test_snapshot_query.py
import pytest from middlewared.test.integration.assets.pool import dataset, pool, another_pool from middlewared.test.integration.utils import call @pytest.fixture(scope="module") def fixture1(): with another_pool(): with dataset("test"): with dataset("test/test1"): with datas...
2,976
Python
.py
52
36.288462
115
0.442044
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,215
test_iscsi_host_crud_roles.py
truenas_middleware/tests/api2/test_iscsi_host_crud_roles.py
import pytest from middlewared.test.integration.assets.roles import common_checks @pytest.mark.parametrize("role", ["SHARING_READ", "SHARING_ISCSI_READ", "SHARING_ISCSI_HOST_READ"]) def test_read_role_can_read(unprivileged_user_fixture, role): common_checks(unprivileged_user_fixture, "iscsi.host.query", role, Tr...
1,500
Python
.py
19
75.263158
104
0.766621
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,216
test_serial_consoles.py
truenas_middleware/tests/api2/test_serial_consoles.py
import pytest from middlewared.test.integration.utils import call, ssh import sys import os apifolder = os.getcwd() sys.path.append(apifolder) def test_enabling_serial_port(): ports = call('system.advanced.serial_port_choices') assert 'ttyS0' in ports, ports for port in ports: test_config = {'s...
1,528
Python
.py
30
44.666667
116
0.678091
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,217
test_lock.py
truenas_middleware/tests/api2/test_lock.py
import time import pytest from middlewared.test.integration.utils import client, mock @pytest.mark.flaky(reruns=5, reruns_delay=5) def test_no_lock(): with mock("test.test1", """ from middlewared.service import lock async def mock(self, *args): import asyncio await async...
1,811
Python
.py
50
27.36
74
0.585436
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,218
test_cloud_sync_crud.py
truenas_middleware/tests/api2/test_cloud_sync_crud.py
import pytest from middlewared.service_exception import CallError from middlewared.test.integration.assets.cloud_sync import credential as _credential, task as _task from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call, ssh try: from config import ( ...
2,569
Python
.py
68
30.602941
116
0.629585
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,219
test_account_root_password.py
truenas_middleware/tests/api2/test_account_root_password.py
import pytest from middlewared.service_exception import CallError from middlewared.test.integration.utils import call, client from middlewared.test.integration.assets.account import user from middlewared.test.integration.assets.pool import dataset def test_root_password_disabled(): with client() as c: ro...
2,484
Python
.py
49
36.306122
117
0.540239
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,220
test_boot_scrub.py
truenas_middleware/tests/api2/test_boot_scrub.py
from time import time, sleep from middlewared.test.integration.utils import call def test_get_boot_scrub(request): job_id = call("boot.scrub") stop_time = time() + 600 while True: job = call("core.get_jobs", [["id", "=", job_id]], {"get": True}) if job["state"] in ("RUNNING", "WAITING"): ...
535
Python
.py
15
26.733333
73
0.537718
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,221
test_audit_api_key.py
truenas_middleware/tests/api2/test_audit_api_key.py
import datetime from middlewared.test.integration.utils import call from middlewared.test.integration.utils.audit import expect_audit_method_calls API_KEY_NAME = 'AUDIT_API_KEY' def test_api_key_audit(): payload = {'username': 'root', 'name': API_KEY_NAME} payload2 = {'expires_at': None} api_key_id = No...
1,318
Python
.py
32
31.1875
91
0.56651
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,222
test_draid_record_and_block_size.py
truenas_middleware/tests/api2/test_draid_record_and_block_size.py
import pytest from middlewared.service_exception import ValidationErrors from middlewared.test.integration.assets.pool import another_pool from middlewared.test.integration.utils import call from auto_config import ha @pytest.fixture(scope='module') def check_unused_disks(): if len(call('disk.get_unused')) < 4:...
6,549
Python
.py
160
33.8875
120
0.628086
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,223
test_260_iscsi.py
truenas_middleware/tests/api2/test_260_iscsi.py
import random import string from time import sleep import pytest from assets.websocket.iscsi import initiator, portal, target, target_extent_associate from auto_config import hostname, pool_name from functions import SSH_TEST from middlewared.test.integration.assets.iscsi import iscsi_extent from middlewared.test.int...
14,228
Python
.py
306
36.986928
142
0.614879
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,224
test_006_pool_and_sysds.py
truenas_middleware/tests/api2/test_006_pool_and_sysds.py
import time import pytest from pytest_dependency import depends from auto_config import ha, pool_name from truenas_api_client import ValidationErrors from middlewared.test.integration.assets.directory_service import active_directory from middlewared.test.integration.utils import call, fail from middlewared.test.integ...
9,608
Python
.py
211
38.421801
101
0.654023
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,225
test_440_snmp.py
truenas_middleware/tests/api2/test_440_snmp.py
#!/usr/bin/env python3 # License: BSD import os import pytest from time import sleep from contextlib import ExitStack from middlewared.service_exception import ValidationErrors from middlewared.test.integration.assets.pool import dataset, snapshot from middlewared.test.integration.assets.filesystem import directory,...
16,335
Python
.py
370
36
123
0.59786
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,226
test_zpool_status.py
truenas_middleware/tests/api2/test_zpool_status.py
import os import pytest from middlewared.test.integration.assets.pool import another_pool from middlewared.test.integration.utils import call, ssh POOL_NAME = 'test_format_pool' ZFS_PART_UUID = '6a898cc3-1dd2-11b2-99a6-080020736631' def get_disk_uuid_mapping(unused_disks): disk_uuid = {} for disk in filte...
11,650
Python
.py
250
30.832
112
0.471803
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,227
test_config_upload.py
truenas_middleware/tests/api2/test_config_upload.py
import contextlib import io import json import sqlite3 import tarfile import os import pytest from truenas_api_client import ClientException from middlewared.test.integration.utils import call, session, url @contextlib.contextmanager def db_ops(db_name): try: with contextlib.closing(sqlite3.connect(db_n...
1,824
Python
.py
51
24.941176
96
0.552721
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,228
test_snapshots.py
truenas_middleware/tests/api2/test_snapshots.py
import errno import pytest from middlewared.service_exception import CallError from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call def common_min_max_txg_snapshot_test(test_min_txg=False, test_max_txg=False): assert all(i is False for i in (test_min_t...
1,909
Python
.py
39
40.025641
114
0.616838
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,229
test_auth_otp.py
truenas_middleware/tests/api2/test_auth_otp.py
import io import json import pytest from middlewared.test.integration.utils import call, session, ssh, url @pytest.fixture(scope="module") def otp_enabled(): call("auth.twofactor.update", {"enabled": True}) try: yield finally: ssh("midclt call auth.twofactor.update '{\"enabled\": false}...
1,121
Python
.py
32
26.1875
91
0.56308
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,230
test_system_lifetime.py
truenas_middleware/tests/api2/test_system_lifetime.py
import time import pytest from middlewared.test.integration.utils import call from auto_config import ha @pytest.mark.skipif( ha, reason="Cannot be tested on a HA system since rebooting this node will just fail over to another node", ) def test_system_reboot(): boot_id = call("system.boot_id") cal...
867
Python
.py
29
22.931034
107
0.594692
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,231
test_tunables.py
truenas_middleware/tests/api2/test_tunables.py
import pytest from truenas_api_client import ValidationErrors from middlewared.test.integration.utils import call, ssh from middlewared.test.integration.utils.mock_binary import mock_binary SYSCTL = "kernel.watchdog" SYSCTL_DEFAULT_VALUE = "1" SYSCTL_NEW_VALUE = "0" ZFS = "zil_nocacheflush" ZFS_DEFAULT_VALUE = "0" Z...
4,488
Python
.py
113
32.247788
113
0.597595
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,232
test_replication_role.py
truenas_middleware/tests/api2/test_replication_role.py
import pytest from middlewared.service_exception import ValidationErrors from middlewared.test.integration.assets.account import unprivileged_user_client from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.assets.replication import replication_task @pytest.mark.parametrize(...
4,320
Python
.py
95
28.884211
97
0.47887
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,233
test_replication.py
truenas_middleware/tests/api2/test_replication.py
import contextlib import random import string import pytest from middlewared.service_exception import ValidationErrors from middlewared.test.integration.assets.keychain import localhost_ssh_credentials from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.assets.replication im...
10,110
Python
.py
209
39.483254
119
0.612243
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,234
test_catalog_roles.py
truenas_middleware/tests/api2/test_catalog_roles.py
import pytest from middlewared.test.integration.assets.roles import common_checks @pytest.mark.parametrize('method, role, valid_role, valid_role_exception', ( ('catalog.get_app_details', 'CATALOG_READ', True, True), ('catalog.get_app_details', 'CATALOG_WRITE', True, True), ('catalog.get_app_details', 'DO...
1,530
Python
.py
28
50.214286
113
0.669559
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,235
test_draid.py
truenas_middleware/tests/api2/test_draid.py
import pytest from truenas_api_client import ValidationErrors from middlewared.test.integration.assets.pool import another_pool from middlewared.test.integration.utils import call POOL_NAME = 'test_draid_pool' @pytest.mark.parametrize( 'n_data,n_spare,n_parity', [ (1, 0, 1), (1, 1, 1), ...
3,643
Python
.py
86
29.930233
114
0.506768
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,236
test_alert.py
truenas_middleware/tests/api2/test_alert.py
from time import sleep import pytest from auto_config import pool_name from middlewared.test.integration.utils import call, ssh ID_PATH = "/dev/disk/by-partuuid/" def get_alert_by_id(alert_id): return next(filter(lambda alert: alert["id"] == alert_id, call("alert.list")), None) def wait_for_alert(timeout=12...
2,165
Python
.py
52
35.961538
89
0.657102
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,237
test_pool_dataset_encrypted.py
truenas_middleware/tests/api2/test_pool_dataset_encrypted.py
import errno import pytest from middlewared.service_exception import CallError, ValidationErrors from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call PASSPHRASE = "12345678" def encryption_props(): return { "encryption_options": {"generate_ke...
1,265
Python
.py
30
34.6
94
0.673486
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,238
test_account_query_roles.py
truenas_middleware/tests/api2/test_account_query_roles.py
import pytest from middlewared.test.integration.assets.account import unprivileged_user_client @pytest.mark.parametrize("role", ["READONLY_ADMIN", "FULL_ADMIN"]) def test_user_role_in_account(role): with unprivileged_user_client(roles=[role]) as c: this_user = c.call("user.query", [["username", "=", c.us...
709
Python
.py
12
53.5
88
0.656522
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,239
test_smb_groupmap.py
truenas_middleware/tests/api2/test_smb_groupmap.py
import pytest from middlewared.test.integration.utils import call from middlewared.test.integration.assets.account import group BASE_RID_GROUP = 200000 @pytest.mark.parametrize('groupname,expected_memberof,expected_rid', [ ('builtin_administrators', 'S-1-5-32-544', 512), ('builtin_guests', 'S-1-5-32-546', 5...
2,482
Python
.py
52
41.788462
81
0.631797
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,240
test_usage_reporting.py
truenas_middleware/tests/api2/test_usage_reporting.py
import pytest from itertools import chain from middlewared.test.integration.assets.nfs import nfs_server from middlewared.test.integration.assets.ftp import ftp_server from middlewared.test.integration.assets.pool import dataset as nfs_dataset from middlewared.test.integration.utils import call from middlewared.test.in...
3,282
Python
.py
67
41.761194
114
0.658331
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,241
test_group_utils.py
truenas_middleware/tests/api2/test_group_utils.py
from middlewared.test.integration.utils import call from middlewared.test.integration.assets.account import group, user def test_root_password_disabled(): with group({"name": "group1"}) as g1: with group({"name": "group2"}) as g2: with user({ "username": "test", ...
673
Python
.py
15
32.8
93
0.515244
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,242
test_client_job.py
truenas_middleware/tests/api2/test_client_job.py
import pprint import time import pytest from middlewared.test.integration.utils import client, mock # FIXME: Sometimes an equal message for `SUCCESS` state is being sent (or received) twice, we were not able # to understand why and this does not break anything so we are not willing to waste our time investigating #...
1,215
Python
.py
28
35.821429
112
0.648007
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,243
test_account_shell_choices.py
truenas_middleware/tests/api2/test_account_shell_choices.py
import pytest from middlewared.service_exception import ValidationErrors from middlewared.test.integration.assets.account import group, user from middlewared.test.integration.utils import call def test_shell_choices_has_no_privileges(): with group({ "name": "test_no_privileges", }) as g: asse...
4,277
Python
.py
120
25.383333
75
0.50338
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,244
test_snapshot_task.py
truenas_middleware/tests/api2/test_snapshot_task.py
import pytest from middlewared.service_exception import InstanceNotFound from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.assets.snapshot_task import snapshot_task from middlewared.test.integration.utils import call import sys import os apifolder = os.getcwd() sys.path.ap...
1,470
Python
.py
34
32.705882
75
0.603641
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,245
test_system_settings_roles.py
truenas_middleware/tests/api2/test_system_settings_roles.py
import pytest from middlewared.test.integration.assets.roles import common_checks @pytest.mark.parametrize('role,endpoint,payload,should_work,valid_role_exception,is_return_type_none', [ ('SYSTEM_GENERAL_READ', 'system.general.config', [], True, False, False), ('READONLY_ADMIN', 'system.general.update', [{}]...
1,388
Python
.py
21
61.714286
110
0.703812
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,246
test_audit_basic.py
truenas_middleware/tests/api2/test_audit_basic.py
from middlewared.service_exception import ValidationError, CallError from middlewared.test.integration.assets.account import user, unprivileged_user_client from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.assets.smb import smb_share from middlewared.test.integration.utils i...
15,178
Python
.py
316
38.803797
113
0.590123
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,247
test_rest_api_authentication.py
truenas_middleware/tests/api2/test_rest_api_authentication.py
# -*- coding=utf-8 -*- import contextlib import io import json import pytest import requests from middlewared.test.integration.assets.account import unprivileged_user as unprivileged_user_template from middlewared.test.integration.assets.api_key import api_key from middlewared.test.integration.utils import client fro...
5,386
Python
.py
134
31.783582
118
0.607423
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,248
test_audit_pool.py
truenas_middleware/tests/api2/test_audit_pool.py
import pytest from middlewared.test.integration.assets.pool import another_pool from middlewared.test.integration.utils import call from middlewared.test.integration.utils.audit import expect_audit_log def test_pool_update_audit_success(): with another_pool() as pool: params = [pool['id'], {'autotrim': '...
1,261
Python
.py
33
27.090909
72
0.537643
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,249
test_pool_export.py
truenas_middleware/tests/api2/test_pool_export.py
import pytest from truenas_api_client import ClientException from middlewared.test.integration.assets.pool import another_pool, pool as pool_name from middlewared.test.integration.utils import call, disable_failover, mock def test_systemdataset_migrate_error(): """ On HA this test will fail with the error b...
1,570
Python
.py
33
38.909091
113
0.614829
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,250
test_nfs_share_crud_roles.py
truenas_middleware/tests/api2/test_nfs_share_crud_roles.py
import pytest from middlewared.test.integration.assets.roles import common_checks @pytest.mark.parametrize("role", ["SHARING_READ", "SHARING_NFS_READ"]) def test_read_role_can_read(unprivileged_user_fixture, role): common_checks(unprivileged_user_fixture, "sharing.nfs.query", role, True, valid_role_exception=Fal...
2,114
Python
.py
32
61.34375
113
0.74506
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,251
test_002_system_license.py
truenas_middleware/tests/api2/test_002_system_license.py
import os import time import pytest from auto_config import ha, ha_license from middlewared.test.integration.utils import call @pytest.mark.skipif(not ha, reason='Test only valid for HA') def test_apply_and_verify_license(): if ha_license: _license_string = ha_license else: with open(os.envi...
1,002
Python
.py
27
30.666667
102
0.669421
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,252
test_openssl.py
truenas_middleware/tests/api2/test_openssl.py
import pytest from middlewared.test.integration.utils import call, ssh from auto_config import ha retry = 5 fips_version = "3.0.9" # Sometimes this test fails because the testing environment has broken failover (randomly. Fun transient error. Reports a failed heartbeat). @pytest.mark.flaky(reruns=retry, reruns_dela...
1,553
Python
.py
21
70.333333
259
0.752787
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,253
test_070_alertservice.py
truenas_middleware/tests/api2/test_070_alertservice.py
from middlewared.test.integration.utils import call def test_alert_gets(): call("alertservice.query") def test_alertservice(): data = ["name", "type", "attributes", "level", "enabled"] # create payload = { "name": "Critical Email Test", "type": "Mail", "attributes": { ...
1,094
Python
.py
35
24.314286
75
0.5804
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,254
test_filesystem__file_tail_follow.py
truenas_middleware/tests/api2/test_filesystem__file_tail_follow.py
import time import pytest from middlewared.test.integration.utils import client, ssh import sys import os apifolder = os.getcwd() sys.path.append(apifolder) @pytest.mark.flaky(reruns=5, reruns_delay=5) def test_filesystem__file_tail_follow__grouping(): ssh("echo > /tmp/file_tail_follow.txt") with client()...
1,405
Python
.py
29
41.62069
109
0.650037
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,255
test_mail_admins.py
truenas_middleware/tests/api2/test_mail_admins.py
import pytest from middlewared.test.integration.assets.account import user from middlewared.test.integration.utils import call MAILUSER = 'wilbur' MAILADDR = 'wilbur.spam@ixsystems.com' NONMAIL_USER = 'wilburette' NONMAIL_ADDR = 'wilburette.spam@ixsystems.com' PASSWD = 'abcd1234' @pytest.fixture(scope='module') def...
1,056
Python
.py
31
27.580645
73
0.636899
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,256
test_disk_stats.py
truenas_middleware/tests/api2/test_disk_stats.py
import os import pytest from middlewared.test.integration.assets.pool import another_pool from middlewared.test.integration.utils import call, ssh def get_test_file_path(pool_name: str) -> str: return os.path.join('/mnt', pool_name, 'test_file') @pytest.fixture(scope='module') def disk_pool(): with another...
1,376
Python
.py
26
48.076923
101
0.680867
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,257
test_rest_api_download.py
truenas_middleware/tests/api2/test_rest_api_download.py
import errno import time import pytest import requests from middlewared.service_exception import CallError from middlewared.test.integration.assets.account import unprivileged_user from middlewared.test.integration.utils import call, client, session, url @pytest.mark.parametrize("method", ["test_download_pipe", "te...
4,009
Python
.py
87
38.724138
114
0.626701
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,258
test_alert_classes.py
truenas_middleware/tests/api2/test_alert_classes.py
from unittest.mock import ANY import pytest from pytest_dependency import depends from middlewared.service_exception import ValidationErrors from middlewared.test.integration.utils import call def test__normal_alert_class(): value = { "classes": { "UPSBatteryLow": { "level":...
1,510
Python
.py
44
24.977273
103
0.580979
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,259
test_035_ad_idmap.py
truenas_middleware/tests/api2/test_035_ad_idmap.py
#!/usr/bin/env python3 # Author: Eric Turgeon # License: BSD # Location for tests into REST API of FreeNAS import pytest import sys import os import json apifolder = os.getcwd() sys.path.append(apifolder) from auto_config import hostname from base64 import b64decode from middlewared.service_exception import Validatio...
11,613
Python
.py
319
29.097179
105
0.616836
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,260
test_pool_dataset_unlock.py
truenas_middleware/tests/api2/test_pool_dataset_unlock.py
import contextlib import pytest from middlewared.test.integration.assets.account import user from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.assets.smb import smb_share from middlewared.test.integration.utils import call, ssh from protocols import SMB from samba import n...
3,974
Python
.py
109
26.853211
99
0.589383
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,261
test_audit_smb.py
truenas_middleware/tests/api2/test_audit_smb.py
import os import sys import pytest from middlewared.service_exception import CallError from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call from middlewared.test.integration.utils.audit import expect_audit_method_calls sys.path.append(os.getcwd()) REDACTED_...
2,371
Python
.py
72
24.041667
82
0.566871
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,262
test_426_smb_vss.py
truenas_middleware/tests/api2/test_426_smb_vss.py
#!/usr/bin/env python3 import pytest import sys import os from subprocess import run from time import sleep apifolder = os.getcwd() sys.path.append(apifolder) from functions import PUT, POST, GET, DELETE, SSH_TEST, wait_on_job from auto_config import ( pool_name, user, password, ) from pytest_dependency im...
10,914
Python
.py
299
31.003344
85
0.643358
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,263
test_smart_test_crud.py
truenas_middleware/tests/api2/test_smart_test_crud.py
import contextlib import re import pytest from middlewared.service_exception import ValidationErrors from middlewared.test.integration.utils import call @contextlib.contextmanager def smart_test(data): test = call("smart.test.create", data) try: yield test finally: call("smart.test.delet...
2,829
Python
.py
85
23.305882
108
0.507145
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,264
test_system_dataset.py
truenas_middleware/tests/api2/test_system_dataset.py
import errno import os import pytest from middlewared.service_exception import CallError from middlewared.test.integration.assets.pool import another_pool from middlewared.test.integration.utils import call, pool PASSPHRASE = 'passphrase' @pytest.fixture(scope="module") def passphrase_encrypted_pool_session(): ...
3,422
Python
.py
61
50.47541
99
0.708546
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,265
test_device_get_disks_size.py
truenas_middleware/tests/api2/test_device_get_disks_size.py
from middlewared.test.integration.utils import call, ssh def test_device_get_disks_size(): boot_disk = call('boot.get_disks')[0] fdisk_size = int(ssh(f'fdisk -s /dev/{boot_disk}').strip()) * 1024 assert call('device.get_disks')[boot_disk]['size'] == fdisk_size
275
Python
.py
5
51.2
70
0.690299
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,266
test_zfs_dataset_list.py
truenas_middleware/tests/api2/test_zfs_dataset_list.py
from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call, ssh def test__unlocked_zvols_fast__volmode(): with dataset("container") as container: ssh(f"zfs set volmode=full {container}") with dataset("container/zvol", {"type": "VOLUME", "volsi...
532
Python
.py
8
59.5
117
0.657692
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,267
test_005_interface.py
truenas_middleware/tests/api2/test_005_interface.py
import time import os import errno import pytest from middlewared.service_exception import ValidationError, ValidationErrors from auto_config import interface, ha, netmask from middlewared.test.integration.utils.client import client, truenas_server from middlewared.test.integration.utils import call @pytest.fixture...
5,426
Python
.py
121
36.181818
91
0.628171
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,268
test_001_ssh.py
truenas_middleware/tests/api2/test_001_ssh.py
import collections import json import os import pytest from functions import if_key_listed, SSH_TEST from auto_config import sshKey, user, password from middlewared.test.integration.utils import fail, ssh from middlewared.test.integration.utils.client import client, truenas_server @pytest.fixture(scope='module') de...
7,074
Python
.py
135
45.659259
112
0.638406
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,269
test_347_posix_mode.py
truenas_middleware/tests/api2/test_347_posix_mode.py
#!/usr/bin/env python3 # License: BSD import os import pytest import stat from functions import SSH_TEST from middlewared.test.integration.assets.account import user, group from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call, ssh from time import sleep M...
14,219
Python
.py
357
33.467787
85
0.628634
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,270
test_filesystem__put.py
truenas_middleware/tests/api2/test_filesystem__put.py
import json import os import sys import tempfile apifolder = os.getcwd() sys.path.append(apifolder) from functions import wait_on_job, POST from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call def upload_file(file_path, file_path_on_tn): data = {'method...
1,763
Python
.py
46
30.608696
86
0.620305
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,271
test_300_nfs.py
truenas_middleware/tests/api2/test_300_nfs.py
import contextlib import ipaddress import os import re from copy import copy from time import sleep import pytest from middlewared.service_exception import ( ValidationError, ValidationErrors, CallError, InstanceNotFound ) from middlewared.test.integration.assets.account import group as create_group from middlewa...
79,478
Python
.py
1,542
40.068742
322
0.570345
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,272
test_snapshot_task_retention.py
truenas_middleware/tests/api2/test_snapshot_task_retention.py
from datetime import datetime from unittest.mock import ANY import pytz from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.assets.snapshot_task import snapshot_task from middlewared.test.integration.utils import assert_creates_job, call def test_change_retention(): tz...
4,428
Python
.py
93
34.473118
112
0.517841
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,273
test_crud_events.py
truenas_middleware/tests/api2/test_crud_events.py
import contextlib import threading import typing from middlewared.test.integration.assets.crypto import get_cert_params, root_certificate_authority from middlewared.test.integration.utils import call from middlewared.test.integration.utils.client import client def event_thread(event_endpoint: str, context: dict): ...
4,844
Python
.py
106
36.811321
108
0.621972
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,274
test_virt_001_global.py
truenas_middleware/tests/api2/test_virt_001_global.py
from middlewared.test.integration.utils.call import call from middlewared.test.integration.utils.ssh import ssh from auto_config import pool_name def test_virt_pool(): call('virt.global.update', {'pool': pool_name}, job=True) ssh(f'zfs list {pool_name}/.ix-virt') def test_virt_no_pool(): call('virt.gl...
565
Python
.py
12
43.416667
77
0.711927
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,275
test_275_ldap.py
truenas_middleware/tests/api2/test_275_ldap.py
import pytest from middlewared.test.integration.assets.directory_service import ldap, LDAPUSER, LDAPPASSWORD from middlewared.test.integration.assets.privilege import privilege from middlewared.test.integration.assets.product import product_type from middlewared.test.integration.utils import call, client pytestmark =...
2,336
Python
.py
55
36.2
94
0.655157
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,276
test_initshutdownscript.py
truenas_middleware/tests/api2/test_initshutdownscript.py
import base64 import contextlib import errno import stat import time import pytest from middlewared.test.integration.utils import client, ssh from middlewared.service_exception import ValidationErrors, ValidationError TEST_SCRIPT_FILE = '/root/.TEST_SCRIPT_FILE' _775 = stat.S_IRWXU | stat.S_IRWXG | stat.S_IROTH | st...
3,502
Python
.py
88
32.545455
102
0.644504
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,277
test_cloud_sync_config.py
truenas_middleware/tests/api2/test_cloud_sync_config.py
import time from middlewared.test.integration.assets.cloud_sync import credential, task from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call from middlewared.test.integration.utils.mock_rclone import mock_rclone def test_rclone_config_writer_bool(): wit...
1,206
Python
.py
29
28.689655
88
0.523891
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,278
test_replication_sudo.py
truenas_middleware/tests/api2/test_replication_sudo.py
import pytest from middlewared.test.integration.assets.account import user from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call, password, ssh @pytest.mark.parametrize("task", [ {"direction": "PUSH", "also_include_naming_schema": ["auto-%Y-%m-%d-%H-%M"]...
2,243
Python
.py
50
28.66
98
0.463682
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,279
test_dataset_mount.py
truenas_middleware/tests/api2/test_dataset_mount.py
from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call, ssh def test_dataset_mount_on_readonly_dataset(): src_parent_dataset_name = 'parent_src' with dataset(src_parent_dataset_name) as parent_src: with dataset(f'{src_parent_dataset_name}/child...
1,038
Python
.py
17
47.705882
120
0.57998
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,280
test_smb_encryption.py
truenas_middleware/tests/api2/test_smb_encryption.py
import os import pytest from contextlib import contextmanager from middlewared.test.integration.assets.account import user from middlewared.test.integration.assets.smb import smb_share from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call from protocols impor...
4,374
Python
.py
105
33.038095
94
0.608583
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,281
test_mail.py
truenas_middleware/tests/api2/test_mail.py
from middlewared.test.integration.utils import call def test_config_settings(): payload = { "fromemail": "william.spam@ixsystems.com", "outgoingserver": "mail.ixsystems.com", "pass": "changeme", "port": 25, "security": "PLAIN", "smtp": True, "user": "william...
504
Python
.py
15
27.133333
51
0.622177
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,282
test_websocket_local_ip.py
truenas_middleware/tests/api2/test_websocket_local_ip.py
from middlewared.test.integration.utils import call from middlewared.test.integration.utils.client import truenas_server def test_websocket_local_ip(): """This tests to ensure we return the local IP address of the TrueNAS system based on the websocket session.""" assert call("interface.websocket_local_ip"...
343
Python
.py
6
53.833333
68
0.78806
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,283
test_can_access_as_user.py
truenas_middleware/tests/api2/test_can_access_as_user.py
import contextlib import pytest from middlewared.test.integration.assets.pool import dataset, pool from middlewared.test.integration.utils import call, ssh import sys import os apifolder = os.getcwd() sys.path.append(apifolder) @contextlib.contextmanager def file(name, user, group, permissions): with dataset('t...
3,076
Python
.py
60
44.183333
106
0.626711
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,284
test_disk_get_dev_size.py
truenas_middleware/tests/api2/test_disk_get_dev_size.py
import json import pytest from middlewared.test.integration.utils import call, ssh @pytest.fixture(scope="session") def blockdevices(): return {i['name']: i for i in json.loads(ssh('lsblk -bJ -o NAME,SIZE'))['blockdevices']} def test_get_dev_size_for_all_disks(blockdevices): for disk, disk_info in blockde...
403
Python
.py
9
41.333333
92
0.726804
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,285
test_310_service_announcement.py
truenas_middleware/tests/api2/test_310_service_announcement.py
import contextlib import random import re import socket import string from datetime import datetime, timedelta from time import sleep from typing import cast import pytest from assets.websocket.server import reboot from assets.websocket.service import (ensure_service_disabled, ens...
19,493
Python
.py
416
34.850962
117
0.582781
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,286
test_job_result.py
truenas_middleware/tests/api2/test_job_result.py
from middlewared.test.integration.utils import call, mock def test_job_result(): with mock("test.test1", """ from middlewared.service import job from middlewared.schema import returns, Password @job() @returns(Password("my_password")) def mock(self, job, *args): ...
916
Python
.py
20
37.45
104
0.593926
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,287
test_011_user.py
truenas_middleware/tests/api2/test_011_user.py
import contextlib import dataclasses import os import time import stat import pytest from pytest_dependency import depends from truenas_api_client import ClientException from middlewared.service_exception import ValidationErrors from middlewared.test.integration.assets.account import user as user_asset from middlewar...
25,965
Python
.py
594
36.33165
126
0.62269
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,288
test_crud.py
truenas_middleware/tests/api2/test_crud.py
import contextlib import pytest from middlewared.test.integration.assets.privilege import privilege from middlewared.test.integration.utils import client @pytest.mark.parametrize('offset,limit', [ (0, 4), (1, 4), (2, 4), (3, 4), (2, 5), (3, 5), ]) def test_query_filters(offset, limit): wi...
904
Python
.py
26
26.423077
111
0.568
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,289
test_audit_permission.py
truenas_middleware/tests/api2/test_audit_permission.py
import os from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call from middlewared.test.integration.utils.audit import expect_audit_method_calls JENNY = 8675309 def test_audit_chown(): with dataset('audit_chown') as ds: path = os.path.join('/mnt',...
1,741
Python
.py
43
31.395349
78
0.573547
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,290
test_auth_token.py
truenas_middleware/tests/api2/test_auth_token.py
import io import json import pytest import requests from middlewared.test.integration.assets.account import unprivileged_user as unprivileged_user_template from middlewared.test.integration.utils import call, client, ssh from middlewared.test.integration.utils.client import truenas_server from middlewared.test.integr...
3,180
Python
.py
75
35.56
118
0.653984
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,291
test_groupmap_migrate_share.py
truenas_middleware/tests/api2/test_groupmap_migrate_share.py
import os import pytest import json from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.assets.smb import smb_share from middlewared.test.integration.utils import call, ssh SMB_NAME = 'groupmap_migrate' RO_ADMINS = 'truenas_readonly_administrators' @pytest.fixture(scope='m...
2,335
Python
.py
51
38.45098
84
0.609079
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,292
test_pool_is_upgraded_alert_removal.py
truenas_middleware/tests/api2/test_pool_is_upgraded_alert_removal.py
import contextlib import time from middlewared.test.integration.assets.pool import another_pool from middlewared.test.integration.utils import call, ssh def assert_has_outdated_pool_alert(pool_name, has): for i in range(60): alerts = call("alert.list") if any((i["klass"] == "PoolUpgraded" and i["...
1,148
Python
.py
28
34.857143
97
0.670578
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,293
test_cloud_sync_storj.py
truenas_middleware/tests/api2/test_cloud_sync_storj.py
import pytest from config import ( STORJ_IX_AWS_ACCESS_KEY_ID, STORJ_IX_AWS_SECRET_ACCESS_KEY, STORJ_IX_BUCKET, ) from middlewared.test.integration.utils import call, ssh from middlewared.test.integration.assets.cloud_sync import credential, task, run_task from middlewared.test.integration.assets.pool impo...
2,362
Python
.py
67
28.567164
114
0.623354
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,294
test_account.py
truenas_middleware/tests/api2/test_account.py
from middlewared.test.integration.assets.account import user, group from middlewared.test.integration.utils import call, client from middlewared.test.integration.utils.audit import expect_audit_method_calls def test_create_account_audit(): user_id = None try: with expect_audit_method_calls([{ ...
3,677
Python
.py
110
23.027273
107
0.49197
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,295
test_vmware.py
truenas_middleware/tests/api2/test_vmware.py
import contextlib import ssl import time import types import pytest from pyVim import connect, task as VimTask from pyVmomi import vim from middlewared.test.integration.assets.nfs import nfs_share from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.assets.snapshot_task impor...
5,841
Python
.py
162
24.364198
105
0.562909
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,296
test_bootenv.py
truenas_middleware/tests/api2/test_bootenv.py
import errno import pytest from middlewared.service_exception import ValidationErrors, ValidationError from middlewared.test.integration.utils import call, ssh def test_get_default_environment_and_make_new_one(): active_be_id = call('bootenv.query', [['activated', '=', True]], {'get': True})['id'] # create...
2,241
Python
.py
43
45.860465
105
0.635073
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,297
test_pool_dataset_snapshot_count.py
truenas_middleware/tests/api2/test_pool_dataset_snapshot_count.py
import textwrap import pytest from middlewared.test.integration.utils import call, mock from middlewared.test.integration.assets.pool import dataset import os import sys sys.path.append(os.getcwd()) def test_empty_for_locked_root_dataset(): with dataset("test_pool_dataset_snapshot_count") as ds: for i ...
643
Python
.py
16
33.8125
77
0.666667
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,298
test_account_duplicate_uid_gid.py
truenas_middleware/tests/api2/test_account_duplicate_uid_gid.py
import errno import pytest from middlewared.service_exception import ValidationErrors, ValidationError from middlewared.test.integration.assets.account import user, group from middlewared.test.integration.assets.pool import dataset from middlewared.test.integration.utils import call @pytest.fixture(scope="module") ...
1,821
Python
.py
52
25.865385
109
0.575982
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
25,299
test_pool_expand.py
truenas_middleware/tests/api2/test_pool_expand.py
import time from middlewared.test.integration.assets.pool import another_pool from middlewared.test.integration.utils import call, ssh def retry_get_parts_on_disk(disk, max_tries=10): for i in range(max_tries): if parts := call('disk.list_partitions', disk): return parts time.sleep(1)...
2,332
Python
.py
44
45.795455
88
0.646775
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)