-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix asset names for windows and linux
- Loading branch information
1 parent
6ec09af
commit c6d8a9c
Showing
4 changed files
with
34 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
__title__ = "Noble TLS" | ||
__description__ = "Advanced TLS/SSL wrapper for Python" | ||
__version__ = "0.0.93" | ||
__version__ = "0.0.95" | ||
__author__ = "Rawand Ahmed Shaswar" | ||
__license__ = "MIT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,39 @@ | ||
import pytest | ||
from ..utils.asset import root_dir, generate_asset_name | ||
|
||
from noble_tls.utils.asset import root_dir, generate_asset_name # Update the import path as necessary | ||
|
||
def test_root_dir(): | ||
# Test that the root_dir function returns the expected path | ||
# This will be a simple test to check if the returned path ends with the correct folder name | ||
expected_part = 'noble_tls' # Assuming the root directory name is 'NobleTLS' | ||
assert root_dir().endswith(expected_part) | ||
|
||
|
||
def test_generate_asset_name_linux_amd64(mocker): | ||
mocker.patch('noble_tls.utils.asset.get_system_platform', return_value='linux') | ||
mocker.patch('platform.machine', return_value='x86_64') | ||
mocker.patch('platform.system', return_value='Linux') | ||
mocker.patch('platform.machine', return_value='amd64') | ||
# Test that the asset name is correctly generated for Linux amd64 | ||
mocker.patch('ctypes.sizeof', return_value=8) # This will simulate 64-bit architecture | ||
expected_asset_name = 'tls-client-linux-amd64-v1.7.2.so' | ||
assert generate_asset_name() == expected_asset_name | ||
|
||
|
||
def test_generate_asset_name_windows_x86(mocker): | ||
# Test that the asset name is correctly generated for Windows x86 | ||
mocker.patch('noble_tls.utils.asset.get_system_platform', return_value='win32') | ||
mocker.patch('platform.system', return_value='Windows') | ||
mocker.patch('platform.machine', return_value='i686') | ||
mocker.patch('platform.architecture', return_value=('32bit', '')) | ||
|
||
expected_asset_name = 'tls-client-windows-x86-v1.7.2-32.dll' | ||
mocker.patch('ctypes.sizeof', return_value=4) # This will simulate 32-bit architecture | ||
expected_asset_name = 'tls-client-windows-32-v1.7.2.dll' | ||
assert generate_asset_name() == expected_asset_name | ||
|
||
|
||
def test_generate_asset_name_macos_arm64(mocker): | ||
# Test that the asset name is correctly generated for macOS arm64 | ||
mocker.patch('noble_tls.utils.asset.get_system_platform', return_value='darwin') | ||
mocker.patch('platform.system', return_value='Darwin') | ||
mocker.patch('platform.machine', return_value='arm64') | ||
|
||
expected_asset_name = 'tls-client-darwin-arm64-v1.7.2.dylib' | ||
assert generate_asset_name() == expected_asset_name | ||
|
||
|
||
def test_generate_asset_name_unknown_architecture(mocker): | ||
# Test that the asset name is correctly generated for an unknown architecture | ||
mocker.patch('noble_tls.utils.asset.get_system_platform', return_value='linux') | ||
mocker.patch('platform.system', return_value='Linux') | ||
mocker.patch('platform.machine', return_value='unknown_arch') | ||
mocker.patch('platform.system', return_value='darwin') | ||
|
||
expected_asset_name = 'tls-client-darwin-unknown-v1.7.2.dylib' | ||
mocker.patch('ctypes.sizeof', return_value=8) # Assuming 64-bit for an unknown architecture | ||
expected_asset_name = 'tls-client-linux-amd64-v1.7.2.so' | ||
assert generate_asset_name() == expected_asset_name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters