TestHelper formatting
This commit is contained in:
parent
d20da5d803
commit
567855e2d2
1 changed files with 5 additions and 2 deletions
|
@ -3,6 +3,7 @@ import struct
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from util import helper
|
from util import helper
|
||||||
|
from Config import config
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("resetSettings")
|
@pytest.mark.usefixtures("resetSettings")
|
||||||
|
@ -22,7 +23,10 @@ class TestHelper:
|
||||||
assert len(helper.packAddress(ip, port)) == 18
|
assert len(helper.packAddress(ip, port)) == 18
|
||||||
assert helper.unpackAddress(helper.packAddress(ip, port)) == (ip, port)
|
assert helper.unpackAddress(helper.packAddress(ip, port)) == (ip, port)
|
||||||
|
|
||||||
with pytest.raises(struct.error) as err:
|
assert len(helper.packOnionAddress("boot3rdez4rzn36x.onion", port)) == 12
|
||||||
|
assert helper.unpackOnionAddress(helper.packOnionAddress("boot3rdez4rzn36x.onion", port)) == ("boot3rdez4rzn36x.onion", port)
|
||||||
|
|
||||||
|
with pytest.raises(struct.error):
|
||||||
helper.packAddress("1.1.1.1", 100000)
|
helper.packAddress("1.1.1.1", 100000)
|
||||||
|
|
||||||
with pytest.raises(socket.error):
|
with pytest.raises(socket.error):
|
||||||
|
@ -39,7 +43,6 @@ class TestHelper:
|
||||||
assert helper.getDirname("data/users/") == "data/users/"
|
assert helper.getDirname("data/users/") == "data/users/"
|
||||||
assert helper.getDirname("/data/users/content.json") == "data/users/"
|
assert helper.getDirname("/data/users/content.json") == "data/users/"
|
||||||
|
|
||||||
|
|
||||||
def testGetFilename(self):
|
def testGetFilename(self):
|
||||||
assert helper.getFilename("data/users/content.json") == "content.json"
|
assert helper.getFilename("data/users/content.json") == "content.json"
|
||||||
assert helper.getFilename("data/users") == "users"
|
assert helper.getFilename("data/users") == "users"
|
||||||
|
|
Loading…
Reference in a new issue