Skip to content

Commit

Permalink
✅ added unit test for get_info
Browse files Browse the repository at this point in the history
  • Loading branch information
mraniki committed Jul 11, 2023
1 parent d608a15 commit b8deab5
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

from datetime import datetime
import pytest
from unittest.mock import patch
from findmyorder import FindMyOrder, settings




@pytest.fixture(scope="session", autouse=True)
def set_test_settings():
settings.configure(FORCE_ENV_FOR_DYNACONF="testing")
Expand Down Expand Up @@ -98,9 +95,17 @@ def invalid_order():
async def test_settings():
"""Search Testing"""
assert settings.VALUE == "On Testing"
assert settings.findmyorder_enabled == True
assert settings.findmyorder_enabled is True

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.


@pytest.mark.asyncio
async def test_info(fmo):
"""Search Testing"""
result = await fmo.get_info()
print(result)
assert result is not None

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert str(result).startswith("FindMyOrder")

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

@pytest.mark.asyncio
async def test_search_valid_order(fmo, crypto_order):
"""Search Testing"""
Expand Down Expand Up @@ -179,7 +184,7 @@ async def test_short_valid_get_order(fmo, short_order, result_order):


@pytest.mark.asyncio
async def test_ignoteorder(fmo, ignore_order):
async def test_ignore_eorder(fmo, ignore_order):
"""ignore order Testing"""
result = await fmo.get_order(ignore_order)
assert result is None
Expand All @@ -193,10 +198,11 @@ async def test_mapping_order(
"""replace instrument Testing"""
result = await fmo.get_order(crypto_short_order)
print(result)
assert settings.instrument_mapping == True
assert settings.instrument_mapping is True

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert result["instrument"] == result_crypto_order["instrument"]
assert type(result["timestamp"] is datetime)


@pytest.mark.asyncio
async def test_contains_no_emoji(fmo, order):
"""check emoji"""
Expand Down Expand Up @@ -226,4 +232,3 @@ def func_that_raises():

# Check that the function returned None
assert result is None

0 comments on commit b8deab5

Please sign in to comment.