init comit
This commit is contained in:
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
0
tests/api/__init__.py
Normal file
0
tests/api/__init__.py
Normal file
0
tests/api/http/__init__.py
Normal file
0
tests/api/http/__init__.py
Normal file
16
tests/api/http/test_sap.py
Normal file
16
tests/api/http/test_sap.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import unittest
|
||||
from mmgs108.api.http.sap import Sap
|
||||
from mmgs108.ui.kivy.app import Gs108App
|
||||
|
||||
|
||||
class TestSap(unittest.TestCase):
|
||||
def test_generate_url(self):
|
||||
sap = Sap("foo")
|
||||
self.assertEqual("http://foo/bar", sap.generate_url("bar"))
|
||||
|
||||
def test_runServer(self):
|
||||
Gs108App(["10.0.0.254"]).run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
25
tests/api/http/test_vlan_table.py
Normal file
25
tests/api/http/test_vlan_table.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import unittest
|
||||
import random
|
||||
from mmgs108.api.http.sap import Sap
|
||||
from mmgs108.api.http.session import Session
|
||||
from mmgs108.api.http.vlan_table import VLanTable
|
||||
|
||||
|
||||
class TestVLanTable(unittest.TestCase):
|
||||
|
||||
def test_get_vlan_table(self):
|
||||
sap = Sap("10.0.0.254")
|
||||
vlan_id = random.randrange(1, 4095)
|
||||
port_key = "port{}".format(random.randrange(2, 8))
|
||||
with Session(sap, "password") as session1:
|
||||
table = VLanTable(session1)
|
||||
table[port_key] = vlan_id
|
||||
self.assertEqual(str(vlan_id), table[port_key])
|
||||
|
||||
with Session(sap, "password") as session2:
|
||||
table = VLanTable(session2)
|
||||
self.assertEqual(str(vlan_id), table[port_key])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user