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,300 | test_iscsi.py | truenas_middleware/tests/api2/test_iscsi.py | import pytest
from middlewared.service_exception import ValidationErrors
from middlewared.test.integration.assets.iscsi import iscsi_extent
from middlewared.test.integration.assets.pool import dataset
from middlewared.test.integration.utils import call
def test__iscsi_extent__disk_choices(request):
with dataset(... | 2,573 | Python | .py | 59 | 33.745763 | 108 | 0.55853 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,301 | test_003_network_global.py | truenas_middleware/tests/api2/test_003_network_global.py | import sys
import os
apifolder = os.getcwd()
sys.path.append(apifolder)
import pytest
from pytest_dependency import depends
from auto_config import ha, interface, hostname, domain, gateway
from middlewared.test.integration.utils.client import client, truenas_server
@pytest.fixture(scope='module')
def ws_client():
... | 3,424 | Python | .py | 70 | 42.057143 | 119 | 0.671257 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,302 | test_virt_002_instance.py | truenas_middleware/tests/api2/test_virt_002_instance.py | from threading import Event
from middlewared.test.integration.assets.filesystem import mkfile
from middlewared.test.integration.assets.pool import dataset
from middlewared.test.integration.utils.client import client
from middlewared.test.integration.utils.call import call
from middlewared.test.integration.utils.ssh im... | 5,832 | Python | .py | 118 | 42.838983 | 124 | 0.615859 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,303 | test_pool_replace_disk_settings_description.py | truenas_middleware/tests/api2/test_pool_replace_disk_settings_description.py | import pytest
from middlewared.test.integration.assets.pool import _2_disk_mirror_topology, another_pool
from middlewared.test.integration.utils import call
@pytest.fixture(scope="module")
def pool():
with another_pool(topology=_2_disk_mirror_topology) as pool:
yield pool
@pytest.mark.parametrize("pres... | 1,427 | Python | .py | 28 | 45.642857 | 101 | 0.681295 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,304 | test_cloud_sync_credentials.py | truenas_middleware/tests/api2/test_cloud_sync_credentials.py | from middlewared.test.integration.assets.cloud_sync import local_ftp_credential_data
from middlewared.test.integration.utils import call
def test_verify_cloud_credential():
with local_ftp_credential_data() as data:
assert call("cloudsync.credentials.verify", data)["valid"]
def test_verify_cloud_credenti... | 492 | Python | .py | 9 | 49.666667 | 84 | 0.745303 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,305 | test_account_privilege_role.py | truenas_middleware/tests/api2/test_account_privilege_role.py | import errno
import logging
from time import sleep
import pytest
from middlewared.service_exception import CallError
from middlewared.test.integration.assets.account import unprivileged_user_client
from middlewared.test.integration.assets.pool import dataset, snapshot
from middlewared.test.integration.utils import cl... | 6,418 | Python | .py | 136 | 38.727941 | 98 | 0.616113 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,306 | test_smb_null_empty_dacl.py | truenas_middleware/tests/api2/test_smb_null_empty_dacl.py | import json
import os
import pytest
from middlewared.test.integration.assets.smb import smb_share
from middlewared.test.integration.assets.pool import dataset
from middlewared.test.integration.utils import call, ssh
from middlewared.test.integration.utils.smb import security, smb_connection
from samba import ntstatus,... | 5,012 | Python | .py | 107 | 40.009346 | 105 | 0.655731 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,307 | test_530_ups.py | truenas_middleware/tests/api2/test_530_ups.py | import os
from tempfile import NamedTemporaryFile
from time import sleep
import pytest
from assets.websocket.service import ensure_service_enabled, ensure_service_started
from auto_config import password, user
from functions import send_file
from middlewared.test.integration.utils import call, mock, ssh
from middlew... | 7,505 | Python | .py | 188 | 34.351064 | 131 | 0.660429 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,308 | test_account_privilege_authentication.py | truenas_middleware/tests/api2/test_account_privilege_authentication.py | import errno
import json
import logging
import pytest
import websocket
from middlewared.service_exception import CallError
from middlewared.test.integration.assets.account import user, unprivileged_user as unprivileged_user_template
from middlewared.test.integration.assets.pool import dataset
from middlewared.test.in... | 7,142 | Python | .py | 145 | 42.165517 | 119 | 0.69213 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,309 | test_nfsv4_top_level_dataset.py | truenas_middleware/tests/api2/test_nfsv4_top_level_dataset.py | import pytest
from middlewared.test.integration.assets.pool import dataset
from middlewared.test.integration.utils import call, pool
@pytest.fixture(scope='module')
def set_nfsv4_top_level():
call('pool.dataset.update', pool, {'acltype': 'NFSV4', 'aclmode': 'PASSTHROUGH'})
try:
yield
finally:
... | 681 | Python | .py | 15 | 40.2 | 85 | 0.666161 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,310 | test_webui_crypto_service.py | truenas_middleware/tests/api2/test_webui_crypto_service.py | import errno
import pytest
from middlewared.service_exception import CallError
from middlewared.test.integration.assets.account import unprivileged_user_client
from middlewared.test.integration.utils import call
@pytest.mark.parametrize('role,endpoint,valid_role', (
('READONLY_ADMIN', 'webui.crypto.certificate_p... | 1,850 | Python | .py | 38 | 41.684211 | 94 | 0.695676 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,311 | test_simple_share.py | truenas_middleware/tests/api2/test_simple_share.py | # -*- coding=utf-8 -*-
import pytest
import secrets
import string
from middlewared.service_exception import ValidationErrors
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 middl... | 1,703 | Python | .py | 36 | 40.111111 | 90 | 0.670894 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,312 | test_ipa_leave.py | truenas_middleware/tests/api2/test_ipa_leave.py | import errno
import pytest
from middlewared.service_exception import CallError
from middlewared.test.integration.assets.directory_service import ipa
from middlewared.test.integration.utils import call
@pytest.fixture(scope="module")
def ipa_config():
""" join then leave IPA domain so that we can evaluate server ... | 2,088 | Python | .py | 49 | 38.081633 | 98 | 0.688679 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,313 | test_schema_private.py | truenas_middleware/tests/api2/test_schema_private.py | import pytest
from middlewared.test.integration.utils import call, client, mock, ssh
def test_private_params_do_not_leak_to_logs():
with mock("test.test1", """
from middlewared.service import accepts
from middlewared.schema import Dict, Str
@accepts(Dict("test", Str("password", priv... | 1,330 | Python | .py | 28 | 38.821429 | 87 | 0.597986 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,314 | test_smb_client.py | truenas_middleware/tests/api2/test_smb_client.py | import os
import pytest
from middlewared.test.integration.assets.account import user, group
from middlewared.test.integration.assets.pool import dataset
from middlewared.test.integration.assets.smb import (
del_stream, get_stream, list_stream, set_stream, set_xattr_compat,
smb_share, smb_mount
)
from middlewar... | 6,891 | Python | .py | 200 | 27.96 | 93 | 0.611161 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,315 | test_009_fenced.py | truenas_middleware/tests/api2/test_009_fenced.py | import pytest
from auto_config import ha
from middlewared.test.integration.utils import call
@pytest.mark.skipif(not ha, reason='HA only test')
def test_01_verify_fenced_is_running():
assert call('failover.fenced.run_info')['running']
| 242 | Python | .py | 6 | 38.166667 | 54 | 0.7897 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,316 | test_iscsi_global_crud_roles.py | truenas_middleware/tests/api2/test_iscsi_global_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_GLOBAL_READ"])
def test_read_role_can_read(unprivileged_user_fixture, role):
common_checks(unprivileged_user_fixture, "iscsi.global.config", rol... | 1,195 | Python | .py | 14 | 82.142857 | 113 | 0.776831 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,317 | test_zpool_capacity_alert.py | truenas_middleware/tests/api2/test_zpool_capacity_alert.py | import pytest
from pytest_dependency import depends
from middlewared.service_exception import CallError
from middlewared.test.integration.utils import call, mock, pool
def test__does_not_emit_alert(request):
with mock("zfs.pool.query", return_value=[
{
"name": pool,
"properties": ... | 1,469 | Python | .py | 46 | 21.804348 | 68 | 0.50742 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,318 | test_core_bulk.py | truenas_middleware/tests/api2/test_core_bulk.py | from unittest.mock import ANY
import pytest
from middlewared.test.integration.assets.account import unprivileged_user_client
from middlewared.test.integration.utils import call, mock
from middlewared.test.integration.utils.audit import expect_audit_log
from truenas_api_client import ClientException
def test_core_bu... | 3,521 | Python | .py | 79 | 32.240506 | 111 | 0.521612 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,319 | test_vmware_state.py | truenas_middleware/tests/api2/test_vmware_state.py | from unittest.mock import ANY
from middlewared.test.integration.utils import call, mock
def test_vmware_state_lifetime():
vmsnapobj = {
"hostname": "host",
"username": "user",
"password": "pass",
}
with mock("vmware.validate_data", return_value=None):
vmware = call("vmware... | 1,199 | Python | .py | 27 | 34.444444 | 99 | 0.562607 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,320 | test_job_events.py | truenas_middleware/tests/api2/test_job_events.py | import pprint
from middlewared.test.integration.assets.account import unprivileged_user_client
from middlewared.test.integration.utils import call, client, mock
def test_successful_job_events():
with mock("test.test1", """
from middlewared.service import job
@job()
def mock(self, job... | 2,184 | Python | .py | 45 | 37.355556 | 119 | 0.573446 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,321 | test_pool_dataset_unlock_recursive.py | truenas_middleware/tests/api2/test_pool_dataset_unlock_recursive.py | from middlewared.test.integration.utils import call, ssh
from middlewared.test.integration.assets.pool import pool
def test_pool_dataset_unlock_recursive():
key = "0" * 32
try:
ssh(f"echo -n '{key}' > /tmp/key")
ssh(f"zfs create -o encryption=on -o keyformat=raw -o keylocation=file:///tmp/key ... | 1,760 | Python | .py | 34 | 41.764706 | 110 | 0.587209 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,322 | test_iscsi_targetextent_crud_roles.py | truenas_middleware/tests/api2/test_iscsi_targetextent_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_TARGETEXTENT_READ"])
def test_read_role_can_read(unprivileged_user_fixture, role):
common_checks(unprivileged_user_fixture, "iscsi.targetextent.... | 1,238 | Python | .py | 15 | 79.2 | 112 | 0.782895 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,323 | test_certs.py | truenas_middleware/tests/api2/test_certs.py | import datetime
import os.path
import textwrap
import cryptography
import pytest
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.x509 impor... | 29,787 | Python | .py | 582 | 40.353952 | 112 | 0.665282 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,324 | test_device_get_disk_names.py | truenas_middleware/tests/api2/test_device_get_disk_names.py | from middlewared.test.integration.utils import call
def test_device_get_disk_names():
assert set(list(call('device.get_disks', False, True))) == set(call('device.get_disk_names'))
| 186 | Python | .py | 3 | 59 | 97 | 0.745856 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,325 | test_acltype.py | truenas_middleware/tests/api2/test_acltype.py | import pytest
from auto_config import pool_name
from middlewared.test.integration.utils import call
from middlewared.test.integration.assets.pool import dataset
def query_filters(ds_name):
return [['id', '=', ds_name]], {'get': True, 'extra': {'retrieve_children': False}}
@pytest.fixture(scope='module')
def te... | 1,445 | Python | .py | 32 | 39.5625 | 120 | 0.6398 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,326 | test_345_acl_nfs4.py | truenas_middleware/tests/api2/test_345_acl_nfs4.py | import secrets
import string
import os
import pytest
from pytest_dependency import depends
from auto_config import pool_name
from functions import SSH_TEST
from middlewared.service_exception import ValidationErrors
from middlewared.test.integration.assets.account import user as create_user
from middlewared.test.integ... | 31,015 | Python | .py | 769 | 33.858257 | 102 | 0.617382 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,327 | test_audit_websocket.py | truenas_middleware/tests/api2/test_audit_websocket.py | # -*- coding=utf-8 -*-
from unittest.mock import ANY
import pytest
from middlewared.service_exception import CallError, ValidationErrors
from middlewared.test.integration.assets.account import unprivileged_user_client, user
from middlewared.test.integration.assets.api_key import api_key
from middlewared.test.integrat... | 15,606 | Python | .py | 409 | 21.599022 | 123 | 0.405306 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,328 | test_audit_iscsi.py | truenas_middleware/tests/api2/test_audit_iscsi.py | import pytest
from middlewared.test.integration.assets.iscsi import iscsi_extent, iscsi_target
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
REDACTED_SECRET = '********'
MB... | 13,611 | Python | .py | 387 | 21.78553 | 111 | 0.458608 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,329 | test_smb_share_crud_roles.py | truenas_middleware/tests/api2/test_smb_share_crud_roles.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.roles import common_checks
from middlewared.test.integration.as... | 3,552 | Python | .py | 62 | 50.612903 | 114 | 0.708981 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,330 | test_keychain_ssh.py | truenas_middleware/tests/api2/test_keychain_ssh.py | import pytest
from middlewared.service_exception import CallError
from middlewared.test.integration.assets.account import user
from middlewared.test.integration.assets.pool import dataset
from middlewared.test.integration.utils import call
@pytest.fixture(scope="module")
def credential():
credential = call("keyc... | 3,120 | Python | .py | 78 | 30.474359 | 108 | 0.598878 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,331 | test_ntpserver_alert.py | truenas_middleware/tests/api2/test_ntpserver_alert.py | import contextlib
import copy
import time
from middlewared.test.integration.utils import call, mock, ssh
CONFIG_FILE = "/etc/chrony/chrony.conf"
BAD_NTP = "172.16.0.0"
@contextlib.contextmanager
def temp_remove_ntp_config():
orig = call("system.ntpserver.query")
try:
for i in orig:
_id =... | 1,717 | Python | .py | 41 | 34.536585 | 116 | 0.640625 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,332 | test_vm_roles.py | truenas_middleware/tests/api2/test_vm_roles.py | import pytest
from middlewared.test.integration.assets.roles import common_checks
@pytest.mark.parametrize('method, expected_error', [
('vm.virtualization_details', False),
('vm.maximum_supported_vcpus', False),
('vm.get_display_devices', True),
('vm.get_display_web_uri', True),
('vm.get_availabl... | 3,244 | Python | .py | 64 | 46.578125 | 114 | 0.678763 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,333 | test_block_hooks.py | truenas_middleware/tests/api2/test_block_hooks.py | import uuid
import pytest
from middlewared.test.integration.utils import client, mock
@pytest.mark.parametrize("block", [True, False])
def test_block_hooks(block):
hook_name = str(uuid.uuid4())
with mock("test.test1", """
async def mock(self, hook_name, blocked_hooks):
from pathlib imp... | 926 | Python | .py | 20 | 35.35 | 95 | 0.625718 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,334 | test_job_credentials.py | truenas_middleware/tests/api2/test_job_credentials.py | from middlewared.test.integration.assets.account import unprivileged_user_client
from middlewared.test.integration.utils import call, mock
from unittest.mock import ANY
def test_job_credentials():
with mock("test.test1", """
from middlewared.service import job
@job()
def mock(self, jo... | 706 | Python | .py | 14 | 42.5 | 118 | 0.621543 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,335 | test_cloud_sync_script.py | truenas_middleware/tests/api2/test_cloud_sync_script.py | import pytest
from truenas_api_client import ClientException
from middlewared.test.integration.assets.cloud_sync import local_ftp_task, run_task
from middlewared.test.integration.utils import call, ssh
def test_pre_script_failure():
with local_ftp_task({
"pre_script": "echo Custom error\nexit 123",
}... | 1,876 | Python | .py | 44 | 35.840909 | 108 | 0.627689 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,336 | test_190_filesystem.py | truenas_middleware/tests/api2/test_190_filesystem.py | #!/usr/bin/env python3
# Author: Eric Turgeon
# License: BSD
import errno
import pytest
import stat
import sys
import os
apifolder = os.getcwd()
sys.path.append(apifolder)
from copy import deepcopy
from functions import POST, PUT, SSH_TEST, wait_on_job
from auto_config import pool_name, user, password
from middlewar... | 14,618 | Python | .py | 311 | 37.33119 | 125 | 0.573243 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,337 | test_438_snapshots.py | truenas_middleware/tests/api2/test_438_snapshots.py | from middlewared.test.integration.assets.pool import dataset, snapshot
from auto_config import pool_name
from middlewared.test.integration.utils import call
def _verify_snapshot_keys_present(snap, expected, unexpected):
"""
Verify that the snapshot returned by the query has the expected keys in its dict
a... | 23,528 | Python | .py | 386 | 50.054404 | 143 | 0.642476 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,338 | test_disk_wipe.py | truenas_middleware/tests/api2/test_disk_wipe.py | import time
import pytest
from auto_config import ha
from middlewared.test.integration.utils import call, ssh
VMFS_MAGIC_STRING_B64 = "DdABwA=="
VMFS_MAGIC_STRING_WFS = "VMFS_volume_member"
def test_disk_wipe_partition_clean():
"""Confirm we clean up around the middle partitions"""
signal_msg = "ix private... | 4,168 | Python | .py | 96 | 36.947917 | 104 | 0.638745 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,339 | test_ipa_join.py | truenas_middleware/tests/api2/test_ipa_join.py | import pytest
from middlewared.test.integration.assets.directory_service import ipa, FREEIPA_ADMIN_BINDPW
from middlewared.test.integration.assets.product import product_type
from middlewared.test.integration.utils import call, client
from middlewared.test.integration.utils.client import truenas_server
@pytest.fixtu... | 3,745 | Python | .py | 77 | 43.701299 | 96 | 0.689722 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,340 | test_disk_format.py | truenas_middleware/tests/api2/test_disk_format.py | import json
import time
from middlewared.test.integration.utils import call, ssh
"""
We use 'parted' to partition disks.
Verification is based on 'parted' documentation (https://people.redhat.com/msnitzer/docs/io-limits.txt):
The heuristic parted uses is:
1) Always use the reported 'alignment_offset' as the ... | 4,169 | Python | .py | 82 | 44.902439 | 107 | 0.676572 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,341 | test_staticroutes.py | truenas_middleware/tests/api2/test_staticroutes.py | import pytest
from middlewared.service_exception import ValidationErrors
from middlewared.test.integration.utils import call, ssh
ROUTE = {
"destination": "127.1.1.1",
"gateway": "127.0.0.1",
"description": "Test Route",
}
BAD_ROUTE = {"destination": "fe80:aaaa:bbbb:cccc::1/64", "gateway": ROUTE["gateway"... | 1,709 | Python | .py | 42 | 35.833333 | 85 | 0.671696 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,342 | test_iscsi_auth_crud_roles.py | truenas_middleware/tests/api2/test_iscsi_auth_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_AUTH_READ"])
def test_read_role_can_read(unprivileged_user_fixture, role):
common_checks(unprivileged_user_fixture, "iscsi.auth.query", role, Tr... | 1,158 | Python | .py | 15 | 73.866667 | 104 | 0.767606 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,343 | test_344_acl_templates.py | truenas_middleware/tests/api2/test_344_acl_templates.py | #!/usr/bin/env python3
import pytest
import sys
import os
from pytest_dependency import depends
apifolder = os.getcwd()
sys.path.append(apifolder)
from functions import POST, GET, PUT, DELETE
from auto_config import pool_name
@pytest.mark.dependency(name="ACLTEMPLATE_DATASETS_CREATED")
@pytest.mark.parametrize('aclt... | 5,695 | Python | .py | 144 | 33.472222 | 77 | 0.642572 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,344 | test_audit_nfs.py | truenas_middleware/tests/api2/test_audit_nfs.py | import pytest
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
@pytest.fixture(scope='module')
def nfs_audit_dataset(request):
with dataset('audit-test-nfs') as ds:
... | 2,682 | Python | .py | 80 | 23.9625 | 82 | 0.548325 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,345 | test_twofactor_auth.py | truenas_middleware/tests/api2/test_twofactor_auth.py | #!/usr/bin/env python3
import contextlib
import errno
import os
import sys
import pytest
apifolder = os.getcwd()
sys.path.append(apifolder)
from middlewared.service_exception import CallError
from middlewared.test.integration.assets.account import user as user_create
from middlewared.test.integration.assets.two_facto... | 10,569 | Python | .py | 229 | 35.436681 | 123 | 0.586046 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,346 | test_boot_attach_replace_detach.py | truenas_middleware/tests/api2/test_boot_attach_replace_detach.py | import pytest
from middlewared.test.integration.utils import call
from auto_config import ha
if not ha:
# the HA VMs only have 1 extra disk at time
# of writing this. QE is aware and is working
# on adding more disks to them so in the meantime
# we have to skip this test since it will fail
# 100% ... | 2,053 | Python | .py | 43 | 38.790698 | 80 | 0.596192 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,347 | test_032_ad_kerberos.py | truenas_middleware/tests/api2/test_032_ad_kerberos.py | import os
import sys
import pytest
from middlewared.test.integration.assets.pool import dataset
apifolder = os.getcwd()
sys.path.append(apifolder)
from functions import SSH_TEST
from auto_config import hostname, password, user
from contextlib import contextmanager
from base64 import b64decode
from protocols import n... | 14,156 | Python | .py | 274 | 44.485401 | 2,662 | 0.705239 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,348 | test_541_vm.py | truenas_middleware/tests/api2/test_541_vm.py | import dataclasses
import time
import pytest
from pytest_dependency import depends
from auto_config import pool_name
from middlewared.test.integration.utils import call
from middlewared.test.integration.assets.pool import dataset
@dataclasses.dataclass
class VmAssets:
# probably best to keep this module
# t... | 10,644 | Python | .py | 228 | 40.22807 | 106 | 0.618543 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,349 | test_pool_is_upgraded.py | truenas_middleware/tests/api2/test_pool_is_upgraded.py | import pytest
from middlewared.test.integration.assets.pool import another_pool, pool
from middlewared.test.integration.utils import call, ssh
@pytest.fixture(scope="module")
def outdated_pool():
with another_pool() as pool:
device = pool["topology"]["data"][0]["path"]
ssh(f"zpool export {pool['n... | 1,195 | Python | .py | 23 | 47.695652 | 102 | 0.683032 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,350 | test_pool_dataset_quota_alert.py | truenas_middleware/tests/api2/test_pool_dataset_quota_alert.py | import re
import pytest
from pytest_dependency import depends
from auto_config import pool_name, user, password
from functions import SSH_TEST
from middlewared.test.integration.utils import call
G = 1024 * 1024 * 1024
@pytest.mark.parametrize("datasets,expected_alerts", [
(
{
"": {
... | 2,411 | Python | .py | 68 | 25.058824 | 119 | 0.509224 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,351 | test_quotas.py | truenas_middleware/tests/api2/test_quotas.py | from dataclasses import dataclass
import pytest
from middlewared.service_exception import ValidationErrors
from middlewared.test.integration.utils import call
from middlewared.test.integration.assets.account import user
from middlewared.test.integration.assets.pool import dataset
@dataclass(frozen=True)
class Quota... | 3,834 | Python | .py | 104 | 28.730769 | 113 | 0.560818 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,352 | test_pool_scrub.py | truenas_middleware/tests/api2/test_pool_scrub.py | import errno
import pytest
from auto_config import pool_name
from middlewared.service_exception import ValidationError, ValidationErrors
from middlewared.test.integration.utils import call
@pytest.fixture(scope="module")
def scrub_info():
for i in call("pool.scrub.query", [["pool_name", "=", pool_name]]):
... | 2,211 | Python | .py | 74 | 19.040541 | 75 | 0.460235 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,353 | test_278_freeipa.py | truenas_middleware/tests/api2/test_278_freeipa.py | #!/usr/bin/env python3
import pytest
import sys
import os
apifolder = os.getcwd()
sys.path.append(apifolder)
from functions import SSH_TEST
from middlewared.test.integration.assets.directory_service import ldap
from middlewared.test.integration.utils import call
from auto_config import ha, user, password
try:
fro... | 3,702 | Python | .py | 83 | 39.662651 | 105 | 0.700222 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,354 | test_200_ftp.py | truenas_middleware/tests/api2/test_200_ftp.py | import contextlib
import copy
import json
import os
import subprocess
from ftplib import all_errors, error_temp
from time import sleep
from timeit import default_timer as timer
from types import SimpleNamespace
import pytest
from pytest_dependency import depends
from assets.websocket.server import reboot
from middlew... | 53,332 | Python | .py | 1,215 | 34.760494 | 117 | 0.602045 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,355 | test_007_early_settings.py | truenas_middleware/tests/api2/test_007_early_settings.py | import stat
from middlewared.test.integration.utils import call
# this is found in middlewared.plugins.sysctl.sysctl_info
# but the client running the tests isn't guaranteed to have
# the middlewared application installed locally
DEFAULT_ARC_MAX_FILE = '/var/run/middleware/default_arc_max'
def test_sysctl_arc_max_i... | 2,269 | Python | .py | 44 | 44.409091 | 108 | 0.66757 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,356 | test_job_lock.py | truenas_middleware/tests/api2/test_job_lock.py | import contextlib
import errno
import os
import time
import pytest
from middlewared.service_exception import CallError
from middlewared.test.integration.assets.account import unprivileged_user_client
from middlewared.test.integration.utils import call, mock, ssh
@pytest.mark.flaky(reruns=5, reruns_delay=5)
def test... | 5,058 | Python | .py | 133 | 27.924812 | 97 | 0.552242 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,357 | test_disk_zfs_guid.py | truenas_middleware/tests/api2/test_disk_zfs_guid.py | from middlewared.test.integration.utils import call
from middlewared.test.integration.utils.mock import mock
from middlewared.test.integration.utils.mock_db import mock_table_contents
from middlewared.test.integration.utils.time_utils import utc_now
DISK_TEMPLATE = {
"disk_subsystem": "scsi",
"disk_number": 2... | 2,323 | Python | .py | 59 | 31.932203 | 112 | 0.578644 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,358 | test_420_smb.py | truenas_middleware/tests/api2/test_420_smb.py | import pytest
import sys
import os
import secrets
import string
import uuid
from time import sleep
apifolder = os.getcwd()
sys.path.append(apifolder)
from protocols import smb_connection
from utils import create_dataset
from auto_config import pool_name
from middlewared.test.integration.assets.account import user
from ... | 14,505 | Python | .py | 366 | 31.737705 | 105 | 0.590993 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,359 | test_encrypted_dataset_services_restart.py | truenas_middleware/tests/api2/test_encrypted_dataset_services_restart.py | import contextlib
import pytest
from pytest_dependency import depends
from middlewared.test.integration.utils import call
from middlewared.test.integration.assets.pool import dataset
import os
import sys
sys.path.append(os.getcwd())
PASSPHRASE = 'testing123'
@contextlib.contextmanager
def enable_auto_start(servic... | 2,329 | Python | .py | 58 | 32.206897 | 102 | 0.634309 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,360 | test_reporting_netdataweb.py | truenas_middleware/tests/api2/test_reporting_netdataweb.py | import pytest
import requests
from requests.auth import HTTPBasicAuth
from middlewared.test.integration.assets.account import unprivileged_user_client
from middlewared.test.integration.utils import call, url
def test_netdata_web_login_succeed():
password = call('reporting.netdataweb_generate_password')
r = r... | 1,001 | Python | .py | 22 | 41.272727 | 90 | 0.718107 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,361 | test_docker_roles.py | truenas_middleware/tests/api2/test_docker_roles.py | import pytest
from middlewared.test.integration.assets.roles import common_checks
@pytest.mark.parametrize('method, role, valid_role, valid_role_exception', (
('docker.status', 'DOCKER_READ', True, False),
('docker.status', 'DOCKER_WRITE', True, False),
('docker.status', 'CATALOG_READ', False, False),
... | 988 | Python | .py | 17 | 54.117647 | 113 | 0.704545 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,362 | test_pool_attach.py | truenas_middleware/tests/api2/test_pool_attach.py | from middlewared.test.integration.assets.pool import another_pool
from middlewared.test.integration.utils import call, ssh
def test_attach_raidz1_vdev():
with another_pool(topology=(6, lambda disks: {
"data": [
{
"type": "RAIDZ1",
"disks": disks[0:3]
... | 766 | Python | .py | 22 | 24.545455 | 65 | 0.5 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,363 | test_iscsi_auth_network.py | truenas_middleware/tests/api2/test_iscsi_auth_network.py | import contextlib
import ipaddress
import socket
import pytest
from middlewared.test.integration.assets.iscsi import target_login_test
from middlewared.test.integration.assets.pool import dataset
from middlewared.test.integration.utils import call, ssh
from middlewared.test.integration.utils.client import truenas_ser... | 7,218 | Python | .py | 164 | 35.439024 | 120 | 0.600313 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,364 | test_large_message.py | truenas_middleware/tests/api2/test_large_message.py | import pytest
from middlewared.service_exception import ValidationErrors
from middlewared.test.integration.utils.client import client
from truenas_api_client import ClientException
MSG_TOO_BIG_ERR = 'Max message length is 64 kB'
def test_large_message_default():
LARGE_PAYLOAD_1 = 'x' * 65537
with pytest.r... | 1,448 | Python | .py | 31 | 40.677419 | 70 | 0.718059 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,365 | test_core_download.py | truenas_middleware/tests/api2/test_core_download.py | import requests
from middlewared.test.integration.utils.client import truenas_server
from middlewared.test.integration.utils import call
def test_get_download_for_config_dot_save():
# set up core download
job_id, url = call('core.download', 'config.save', [], 'freenas.db')
# download from URL
rv = r... | 432 | Python | .py | 10 | 39.4 | 72 | 0.727273 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,366 | test_boot_format.py | truenas_middleware/tests/api2/test_boot_format.py | from middlewared.test.integration.utils import call
def test_optimal_disk_usage():
disk = call('disk.get_unused')[0]
data_size = (
disk['size'] -
1 * 1024 * 1024 - # BIOS boot
512 * 1024 * 1024 - # EFI
73 * 512 # GPT + alignment
)
# Will raise an exception if we fail... | 429 | Python | .py | 11 | 33.090909 | 89 | 0.617788 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,367 | test_pool_dataset_details.py | truenas_middleware/tests/api2/test_pool_dataset_details.py | import pytest
from middlewared.test.integration.assets.cloud_sync import local_ftp_task
from middlewared.test.integration.assets.pool import dataset, pool
from middlewared.test.integration.utils import call, ssh
@pytest.fixture(scope="module")
def cloud_sync_fixture():
with dataset("test_pool_dataset_details") a... | 1,596 | Python | .py | 35 | 39.171429 | 76 | 0.648875 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,368 | iscsi.py | truenas_middleware/tests/api2/assets/websocket/iscsi.py | import contextlib
from time import sleep
from middlewared.test.integration.utils import call
@contextlib.contextmanager
def initiator(comment='Default initiator', initiators=[]):
payload = {
'comment': comment,
'initiators': initiators,
}
initiator_config = call('iscsi.initiator.create', ... | 6,428 | Python | .py | 176 | 29.960227 | 96 | 0.642409 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,369 | service.py | truenas_middleware/tests/api2/assets/websocket/service.py | import contextlib
import os
import sys
from time import sleep
apifolder = os.getcwd()
sys.path.append(apifolder)
from middlewared.test.integration.utils import call
@contextlib.contextmanager
def ensure_service_started(service_name, delay=0):
old_value = call('service.started', service_name)
if old_value:
... | 3,032 | Python | .py | 87 | 25.908046 | 79 | 0.582822 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,370 | server.py | truenas_middleware/tests/api2/assets/websocket/server.py | from time import sleep
from middlewared.test.integration.utils.client import client
from functions import ping_host
def reboot(ip, service_name=None):
"""Reboot the TrueNAS at the specified IP.
Return when it has rebooted."""
with client(host_ip=ip) as c:
# we call this method to "reboot" the sys... | 1,852 | Python | .py | 46 | 30.521739 | 113 | 0.595 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,371 | ms_rpc.py | truenas_middleware/tests/protocols/ms_rpc.py | import re
import subprocess
from collections import namedtuple
from functions import SRVTarget, get_host_ip
RE_SAMR_ENUMDOMAINS = re.compile(r"name:\[(?P<name>\w+)\] idx:\[(?P<idx>\w+)\]")
RE_SAMR_ENUMDOMUSER = re.compile(r"user:\[(?P<user>\w+)\] rid:\[(?P<rid>\w+)\]")
class MS_RPC():
"""
Thin wrapper around... | 3,631 | Python | .py | 95 | 28.957895 | 80 | 0.578468 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,372 | smb_proto.py | truenas_middleware/tests/protocols/smb_proto.py | import sys
import enum
import subprocess
from functions import SRVTarget, get_host_ip
from platform import system
# sys.real_prefix only found in old virtualenv
# if detected set local site-packages to use for samba
# In recent virtual version sys.base_prefix is to be use.
if getattr(sys, "real_prefix", None):
ma... | 11,277 | Python | .py | 296 | 28.885135 | 89 | 0.573155 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,373 | ftp_proto.py | truenas_middleware/tests/protocols/ftp_proto.py | import contextlib
import ssl
from ftplib import FTP, FTP_TLS
# See docs at:
# https://docs.python.org/3/library/ftplib.html
def ftp_connect(host, port=0):
"""
Connect to the specified host, returning an FTP object from ftplib.
"""
ftp = FTP(host, port)
return ftp
def ftps_connect(host, ctx=None... | 1,438 | Python | .py | 53 | 22.075472 | 75 | 0.661572 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,374 | __init__.py | truenas_middleware/tests/protocols/__init__.py | import contextlib
from functions import DELETE, POST
from .ftp_proto import ftp_connect, ftps_connect, ftp_connection, ftps_connection # noqa
from .iscsi_proto import initiator_name_supported, iscsi_scsi_connect, iscsi_scsi_connection # noqa
from .iSNSP.client import iSNSPClient
from .ms_rpc import MS_RPC # noqa
f... | 1,584 | Python | .py | 52 | 25.134615 | 100 | 0.655036 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,375 | iscsi_proto.py | truenas_middleware/tests/protocols/iscsi_proto.py | import contextlib
import inspect
from pyscsi.pyscsi.scsi import SCSI
from pyscsi.utils import init_device
def initiator_name_supported():
"""
Returns whether a non-None initiator name may be supplied.
This can have an impact on what kinds of tests can be run.
"""
return 'initiator_name' in inspe... | 2,583 | Python | .py | 61 | 36.032787 | 127 | 0.678771 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,376 | nfs_proto.py | truenas_middleware/tests/protocols/nfs_proto.py | import sys
from functions import SSH_TEST, SRVTarget, get_host_ip
from platform import system
# sys.real_prefix only found in old virtualenv
# if detected set local site-packages to use for samba
# In recent virtual version sys.base_prefix is to be use.
if getattr(sys, "real_prefix", None):
major_v = sys.version_i... | 13,408 | Python | .py | 342 | 27.809942 | 110 | 0.506343 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,377 | client.py | truenas_middleware/tests/protocols/iSNSP/client.py | import socket
from .exceptions import *
from .packet import *
class iSNSPClient(object):
def __init__(self, host, initiator_iqn, port=3205):
self.host = host
if initiator_iqn:
self.source = iSNSPAttribute.iSCSIName(initiator_iqn)
else:
self.source = None
se... | 5,535 | Python | .py | 128 | 30.03125 | 85 | 0.563404 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,378 | packet.py | truenas_middleware/tests/protocols/iSNSP/packet.py | import struct
from dataclasses import dataclass
from enum import Enum
from typing import ClassVar, Dict, List, Optional
from .exceptions import MalformedPacketError
class ResponseStatus(Enum):
SUCCESSFUL = 0
UNKNOWN_ERROR = 1
MESSAGE_FORMAT_ERROR = 2
INVALID_REGISTRATION = 3
RESERVED = 4
INVA... | 15,911 | Python | .py | 481 | 23.746362 | 79 | 0.49477 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,379 | exceptions.py | truenas_middleware/tests/protocols/iSNSP/exceptions.py | class iSNSPException(Exception):
"""
Base exception for our iSNSP functions
"""
class MalformedPacketError(iSNSPException):
"""
The iSNSP packet has some sort of issue
"""
| 198 | Python | .py | 8 | 20.5 | 43 | 0.702128 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,380 | libpython.py | truenas_middleware/src/freenas/usr/local/share/python-gdb/libpython.py | #!/usr/bin/python
'''
From gdb 7 onwards, gdb's build can be configured --with-python, allowing gdb
to be extended with Python code e.g. for library-specific data visualizations,
such as for the C++ STL types. Documentation on this API can be seen at:
http://sourceware.org/gdb/current/onlinedocs/gdb/Python-API.html
... | 63,797 | Python | .pyt | 1,580 | 29.753165 | 102 | 0.571886 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,381 | test_copytree.py | truenas_middleware/tests/unit/test_copytree.py | import errno
import gc
import os
import pytest
import random
import stat
from middlewared.utils.filesystem import copy
from operator import eq, ne
from unittest.mock import Mock, patch
TEST_FILE_DATASZ = 128 * 1024
TEST_XATTR_DATASZ = 1024
TEST_FILES = [
('testfile1', random.randbytes(TEST_FILE_DATASZ)),
('t... | 17,721 | Python | .pyt | 417 | 35.266187 | 119 | 0.642791 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,382 | test_port_attachments.py | truenas_middleware/src/middlewared/middlewared/pytest/unit/plugins/test_port_attachments.py | import contextlib
import pytest
from unittest.mock import patch
from middlewared.plugins.ports.ports import PortService, ValidationErrors
from middlewared.pytest.unit.middleware import Middleware
PORTS_IN_USE = [
{
'namespace': 'snmp',
'title': 'SNMP Service',
'ports': [
[
... | 12,252 | Python | .tac | 517 | 9.408124 | 107 | 0.259553 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,383 | test_attachment_delegate_is_child_path.py | truenas_middleware/src/middlewared/middlewared/pytest/unit/plugins/test_attachment_delegate_is_child_path.py | import pytest
from middlewared.plugins.smb import SMBFSAttachmentDelegate
from middlewared.pytest.unit.middleware import Middleware
@pytest.mark.parametrize('resource, path, check_parent, exact_match, is_child, expected_output', (
({'path_local': '/mnt/tank/test'}, '/mnt/tank', False, False, True, True),
({'... | 984 | Python | .tac | 16 | 58.0625 | 112 | 0.699482 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,384 | test_attachments.py | truenas_middleware/src/middlewared/middlewared/pytest/unit/plugins/vm/test_attachments.py | import pytest
from middlewared.plugins.vm.attachments import determine_recursive_search
@pytest.mark.parametrize('recursive,device,child_datasets,result', [
(True, {'attributes': {'path': '/mnt/tank/somefile'}, 'dtype': 'CDROM'}, ['tank/child'], True),
(False, {'attributes': {'path': '/dev/zvol/tank/somezvol... | 764 | Python | .tac | 11 | 66.363636 | 105 | 0.689333 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,385 | fs_attachment_delegate.py | truenas_middleware/src/middlewared/middlewared/plugins/nfs_/fs_attachment_delegate.py | from middlewared.common.attachment import LockableFSAttachmentDelegate
from middlewared.plugins.nfs import SharingNFSService
class NFSFSAttachmentDelegate(LockableFSAttachmentDelegate):
name = 'nfs'
title = 'NFS Share'
service = 'nfs'
service_class = SharingNFSService
resource_name = 'path'
... | 565 | Python | .tac | 12 | 42.583333 | 107 | 0.787934 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,386 | port_attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/nfs_/port_attachments.py | from middlewared.common.ports import ServicePortDelegate
class NFSServicePortDelegate(ServicePortDelegate):
bind_address_field = 'bindip'
name = 'nfs'
namespace = 'nfs'
port_fields = ['mountd_port', 'rpcstatd_port', 'rpclockd_port']
title = 'NFS Service'
def bind_address(self, config):
... | 1,019 | Python | .tac | 23 | 36.521739 | 98 | 0.662955 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,387 | attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/ftp_/attachments.py | from middlewared.common.ports import ServicePortDelegate
class FTPServicePortDelegate(ServicePortDelegate):
name = 'FTP'
namespace = 'ftp'
port_fields = ['port']
title = 'FTP Service'
async def setup(middleware):
await middleware.call('port.register_attachment_delegate', FTPServicePortDelegate(... | 333 | Python | .tac | 8 | 37.5 | 98 | 0.778125 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,388 | cert_attachment.py | truenas_middleware/src/middlewared/middlewared/plugins/ftp_/cert_attachment.py | from middlewared.common.attachment.certificate import CertificateServiceAttachmentDelegate
class FTPCertificateAttachment(CertificateServiceAttachmentDelegate):
CERT_FIELD = 'ssltls_certificate'
HUMAN_NAME = 'FTP Service'
SERVICE = 'ftp'
async def setup(middleware):
await middleware.call('certifica... | 392 | Python | .tac | 7 | 52 | 107 | 0.834211 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,389 | fs_attachment_delegate.py | truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/fs_attachment_delegate.py | from middlewared.common.attachment import LockableFSAttachmentDelegate
from .extents import iSCSITargetExtentService
class ISCSIFSAttachmentDelegate(LockableFSAttachmentDelegate):
name = 'iscsi'
title = 'iSCSI Extent'
service = 'iscsitarget'
service_class = iSCSITargetExtentService
async def get... | 1,712 | Python | .tac | 28 | 52.857143 | 114 | 0.704545 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,390 | port_attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/port_attachments.py | from middlewared.common.ports import ServicePortDelegate
class ISCSIGlobalServicePortDelegate(ServicePortDelegate):
name = 'iSCSI'
namespace = 'iscsi.global'
port_fields = ['listen_port']
title = 'iSCSI Service'
async def setup(middleware):
await middleware.call('port.register_attachment_delega... | 369 | Python | .tac | 8 | 42 | 106 | 0.794944 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,391 | attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/reporting/attachments.py | from middlewared.common.ports import ServicePortDelegate
from .netdata.utils import NETDATA_PORT
class ReportingServicePortDelegate(ServicePortDelegate):
name = 'reporting'
namespace = 'reporting'
title = 'Reporting Service'
async def get_ports_bound_on_wildcards(self):
return [NETDATA_PORT... | 458 | Python | .tac | 10 | 41.3 | 104 | 0.795918 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,392 | attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/system_general/attachments.py | from middlewared.common.ports import ServicePortDelegate
class SystemGeneralServicePortDelegate(ServicePortDelegate):
bind_address_field = 'ui_address'
name = 'webui'
namespace = 'system.general'
port_fields = ['ui_port', 'ui_httpsport']
title = 'WebUI Service'
def bind_address(self, config)... | 1,208 | Python | .tac | 29 | 32.758621 | 108 | 0.639316 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,393 | attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/attachments.py | from middlewared.common.ports import ServicePortDelegate
class SMBServicePortDelegate(ServicePortDelegate):
name = 'smb'
namespace = 'smb'
title = 'SMB Service'
async def get_ports_bound_on_wildcards(self):
return [137, 138, 139, 445]
async def setup(middleware):
await middleware.call(... | 393 | Python | .tac | 9 | 38.888889 | 98 | 0.76455 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,394 | attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/attachments.py | import os
from middlewared.common.attachment import FSAttachmentDelegate
class DockerFSAttachmentDelegate(FSAttachmentDelegate):
name = 'docker'
title = 'Docker'
service = 'docker'
async def query(self, path, enabled, options=None):
results = []
k8s_config = await self.middleware.ca... | 1,751 | Python | .tac | 40 | 35.225 | 110 | 0.65822 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,395 | cert_attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/apps/cert_attachments.py | from middlewared.common.attachment.certificate import CertificateCRUDServiceAttachmentDelegate
from middlewared.service import Service
from .ix_apps.metadata import get_collective_config
class AppCertificateAttachmentDelegate(CertificateCRUDServiceAttachmentDelegate):
HUMAN_NAME = 'Applications'
NAMESPACE =... | 2,751 | Python | .tac | 51 | 44.54902 | 115 | 0.660581 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,396 | fs_attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/apps/fs_attachments.py | from middlewared.common.attachment import FSAttachmentDelegate
class AppFSAttachmentDelegate(FSAttachmentDelegate):
name = 'apps'
title = 'Apps'
async def query(self, path, enabled, options=None):
apps_attached = []
for app in await self.middleware.call('app.query'):
# We don'... | 2,448 | Python | .tac | 49 | 38.265306 | 112 | 0.603687 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,397 | port_attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/apps/port_attachments.py | from middlewared.common.ports import PortDelegate
class AppPortDelegate(PortDelegate):
name = 'applications'
namespace = 'app'
title = 'Applications'
async def get_ports(self):
ports = []
for app in filter(
lambda a: a['active_workloads']['used_ports'],
await ... | 879 | Python | .tac | 22 | 29.863636 | 91 | 0.586572 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,398 | cert_attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/system/cert_attachments.py | from middlewared.common.attachment.certificate import CertificateServiceAttachmentDelegate
class SystemGeneralCertificateAttachmentDelegate(CertificateServiceAttachmentDelegate):
CERT_FIELD = 'ui_certificate'
HUMAN_NAME = 'UI Service'
NAMESPACE = 'system.general'
SERVICE = 'http'
class SystemAdvanc... | 838 | Python | .tac | 18 | 41.555556 | 107 | 0.802956 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
25,399 | attach_disk.py | truenas_middleware/src/middlewared/middlewared/plugins/pool_/attach_disk.py | import asyncio
from middlewared.schema import accepts, Bool, Dict, Int, returns, Str
from middlewared.service import job, Service, ValidationErrors
class PoolService(Service):
@accepts(
Int('oid'),
Dict(
'pool_attach',
Str('target_vdev', required=True),
Str('n... | 3,657 | Python | .tac | 76 | 35.802632 | 118 | 0.560258 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |