Projects STRLCPY RTSPbrute Commits 44dcd03e
🤬
  • Add clear_cache

    If this test file is called after the test that used packet.py,
    the cache will have values that need to reset.
  • Loading...
  • Woolf committed 4 years ago
    44dcd03e
    1 parent df82d9fc
  • ■ ■ ■ ■ ■ ■
    tests/test_packet.py
    skipped 14 lines
    15 15  )
    16 16   
    17 17   
    18  -def test_basic_auth():
     18 +@pytest.fixture
     19 +def clear_cache():
     20 + packet._basic_auth.cache_clear()
     21 + packet._ha1.cache_clear()
     22 + 
     23 + 
     24 +def test_basic_auth(clear_cache):
    19 25   assert packet._basic_auth("admin:admin") == basic_auth_str
    20 26   cache = packet._basic_auth.cache_info()
    21 27   assert cache.hits == 0
    skipped 8 lines
    30 36   assert cache.currsize == 2
    31 37   
    32 38   
    33  -def test_ha1():
     39 +def test_ha1(clear_cache):
    34 40   assert packet._ha1("user", "realm", "user") == "54cdcbe980ed379cae3e478ac29c67dc"
    35 41   cache = packet._ha1.cache_info()
    36 42   assert cache.hits == 0
    skipped 8 lines
    45 51   assert cache.currsize == 2
    46 52   
    47 53   
    48  -def test_digest_auth():
     54 +def test_digest_auth(clear_cache):
    49 55   option = "DESCRIBE"
    50 56   ip = "0.0.0.0"
    51 57   port = 554
    skipped 8 lines
    60 66   )
    61 67   
    62 68   
    63  -def test_describe():
     69 +def test_describe(clear_cache):
    64 70   ip = "0.0.0.0"
    65 71   port = 554
    66 72   path = ""
    skipped 32 lines
Please wait...
Page is in error, reload to recover