File: //lib/python3/dist-packages/samba/tests/__pycache__/samdb_api.cpython-310.pyc
o
�/a� � @ sL d dl mZ d dlmZ d dlmZmZ d dlZd dlZG dd� de�Z dS )� )�TestCaseInTempDir)�SamDB)�LdbError�ERR_OPERATIONS_ERRORNc sX e Zd Z� fdd�Z� fdd�Zdd� Zdd� Zd d
� Zdd� Zd
d� Z dd� Z
� ZS )�SamDBApiTestCasec s t t| ��� d S )N)�superr �setUp)�self�� __class__� �7/usr/lib/python3/dist-packages/samba/tests/samdb_api.pyr s zSamDBApiTestCase.setUpc
s� z
t �| jd � W n ty$ } z| �|jtj� W Y d }~nd }~ww z
t �| jd � W n tyI } z| �|jtj� W Y d }~nd }~ww tt| �� � d S )N�/test.db�/existing.db)
�os�remove�tempdir�OSError�assertEqual�errno�ENOENTr r �tearDown)r �er
r r
r s ����zSamDBApiTestCase.tearDownc
C s� | j d }t|d�}|�d� |�� ztd| d� | �d� W n ty> } z|j\}}| �|t � W Y d }~nd }~ww t|d�}|�
� }| �d|� d S )Nr �wzThis is not a tdb file!!!!!!
�tdb://��url�Exception not thrown �r)r �open�write�closer �failr �argsr r �readline)r �
existing_name�existingr �err�_�contentsr r r
�)test_dont_create_db_existing_non_tdb_file2 s
��
z:SamDBApiTestCase.test_dont_create_db_existing_non_tdb_filec C sX | j d }t|d�}|�d� |�� td| dd� t|d�}|�� }| �d|� d S ) Nr �wbs This is not a tdb file!!!!!!r r �r �flags�rb� TDB file
)r r r r! r r$ r )r r% r&