o
    QDiA                     @   sL  d dl Z d dlZd dlZd dlmZmZmZ ejjej	dk dddd Z
ejjej	dk dddd	 Zejjej	dk ddd
d Zejjej	dk dddd Zejjej	dk dddd Zejjej	dk ddejjejdkdddd Zejjej	dk dddd Zejjej	dk ddejjejdkdddd ZdS )    N)FrictionlessExceptionResourceplatform)   
   zpytest-vcr bug in Python3.8/9)reasonc                  C   s   t t} tdtjdd W d    n1 sw   Y  | jj}| jj	}t
|dks0J |jdks7J |jdks>J |d jdksGJ |d jdsQJ d S )	Nnamezdata/table.csvr   path   resource-errordescriptor is not validr   table.csv" is not safe)pytestraisesr   r   osr
   abspathvalueerrorreasonslentypenotecountexcinfor   r    r   e/var/www/Datamplify/venv/lib/python3.10/site-packages/frictionless/resource/__spec__/test_security.py:test_resource_source_path_error_bad_path_not_safe_absolute   s   r   c                  C   s   t t} tdtjdksdndd W d    n1 sw   Y  | jj}| jj}t	|dks3J |jdks:J |j
dksAJ |d	 jdksJJ |d	 j
d
sTJ d S )Nr   windowszdata/../data/table.csvzdata\..\table.csvr	   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <test_resource_source_path_error_bad_path_not_safe_traversing   s    
r    c                  C      t jd} tt}tdd| d W d    n1 sw   Y  |jj}|jj	}t
|dks3J |jdks:J |jdksAJ |d jdksJJ |d jd	sTJ d S )
Nzdata/dialect.jsonr   r
   )r   r
   dialectr   r   r   r   zdialect.json" is not safer   r
   r   r   r   r   r   r   r   r   r   r   r   r   )r"   r   r   r   r   r   r   3test_resource_dialect_from_path_error_path_not_safe.      r$   c                  C   r!   )
Nzdata/schema.jsonr   r
   )r   r
   schemar   r   r   r   zschema.json" is not safer#   )r&   r   r   r   r   r   r   2test_resource_schema_from_path_error_path_not_safe<   r%   r'   c                  C      t jd} tt}tdd| gd W d    n1 sw   Y  |jj}|jj	}t
|dks4J |jdks;J |jdksBJ |d jdksKJ |d jd	sUJ d S )
Nzdata/chunk2.csvr   r
   r   r
   
extrapathsr   r   r   r   chunk2.csv" is not safer#   	extrapathr   r   r   r   r   r   9test_resource_extrapaths_error_bad_path_not_safe_absoluteJ      r.   r   zFix on Windowsc                  C      d} t t}tdd| gd W d    n1 sw   Y  |jj}|jj}t|dks0J |jdks7J |j	dks>J |d jdksGJ |d j	
d	sQJ d S )
Nzdata/../chunk2.csvr   r
   r)   r   r   r   r   r+   r   r   r   r   r   r   r   r   r   r   r   r,   r   r   r   ;test_resource_extrapaths_error_bad_path_not_safe_traversingX      r2   c                  C   r(   )
Nzdata/profiles/camtrap.jsonr   r
   r   r
   profilesr   r   r   r   camtrap.json" is not safer#   profiler   r   r   r   r   r   7test_resource_profiles_error_bad_path_not_safe_absoluteg   r/   r9   c                  C   r0   )
Nz&data/profiles/../profiles/camtrap.jsonr   r
   r4   r   r   r   r   r6   r1   r7   r   r   r   9test_resource_profiles_error_bad_path_not_safe_traversingu   r3   r:   )r   sysr   frictionlessr   r   r   markskipifversion_infor   r    r$   r'   r.   r   r2   r9   r:   r   r   r   r   <module>   s,    





