p3lib 1.1.107__tar.gz → 1.1.109__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- p3lib-1.1.109/PKG-INFO +34 -0
- p3lib-1.1.109/pyproject.toml +16 -0
- p3lib-1.1.109/src/p3lib/login.html +98 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/pconfig.py +4 -4
- p3lib-1.1.107/PKG-INFO +0 -26
- p3lib-1.1.107/pyproject.toml +0 -10
- p3lib-1.1.107/setup.cfg +0 -32
- p3lib-1.1.107/src/p3lib.egg-info/PKG-INFO +0 -26
- p3lib-1.1.107/src/p3lib.egg-info/SOURCES.txt +0 -32
- p3lib-1.1.107/src/p3lib.egg-info/dependency_links.txt +0 -1
- p3lib-1.1.107/src/p3lib.egg-info/requires.txt +0 -2
- p3lib-1.1.107/src/p3lib.egg-info/top_level.txt +0 -1
- p3lib-1.1.107/tests/test_conduit.py +0 -41
- p3lib-1.1.107/tests/test_json_networking.py +0 -100
- p3lib-1.1.107/tests/test_netif.py +0 -79
- p3lib-1.1.107/tests/test_ssh.py +0 -73
- {p3lib-1.1.107 → p3lib-1.1.109}/LICENSE +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/README.md +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/__init__.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/ate.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/bokeh_auth.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/bokeh_gui.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/boot_manager.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/conduit.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/database_if.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/file_io.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/gnome_desktop_app.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/helper.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/json_networking.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/mqtt_rpc.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/netif.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/netplotly.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/ngt.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/ssh.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/table_plot.py +0 -0
- {p3lib-1.1.107 → p3lib-1.1.109}/src/p3lib/uio.py +0 -0
p3lib-1.1.109/PKG-INFO
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: p3lib
|
3
|
+
Version: 1.1.109
|
4
|
+
Summary: A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
5
|
+
Home-page: https://github.com/pjaos/test_equipment
|
6
|
+
License: MIT
|
7
|
+
Author: Paul Austen
|
8
|
+
Author-email: pjaos@gmail.com
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Programming Language :: Python :: 2
|
11
|
+
Classifier: Programming Language :: Python :: 2.7
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
13
|
+
Classifier: Programming Language :: Python :: 3.4
|
14
|
+
Classifier: Programming Language :: Python :: 3.5
|
15
|
+
Classifier: Programming Language :: Python :: 3.6
|
16
|
+
Classifier: Programming Language :: Python :: 3.7
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
22
|
+
Project-URL: Repository, https://github.com/pjaos/test_equipment
|
23
|
+
Description-Content-Type: text/markdown
|
24
|
+
|
25
|
+
# A Python3 library
|
26
|
+
A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
27
|
+
|
28
|
+
## Installation
|
29
|
+
p3lib is available on pypi and can be installed using the following command.
|
30
|
+
|
31
|
+
```
|
32
|
+
pip3 install p3lib
|
33
|
+
```
|
34
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
[tool.poetry]
|
2
|
+
name = "p3lib"
|
3
|
+
version = "1.1.109"
|
4
|
+
description = "A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output."
|
5
|
+
authors = ["Paul Austen <pjaos@gmail.com>"]
|
6
|
+
license = "MIT License"
|
7
|
+
readme = "README.md"
|
8
|
+
homepage = "https://github.com/pjaos/test_equipment"
|
9
|
+
repository = "https://github.com/pjaos/test_equipment"
|
10
|
+
|
11
|
+
[build-system]
|
12
|
+
requires = [
|
13
|
+
"setuptools>=42",
|
14
|
+
"wheel"
|
15
|
+
]
|
16
|
+
build-backend = "setuptools.build_meta"
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Bokeh App with Login</title>
|
5
|
+
<style>
|
6
|
+
*{
|
7
|
+
margin:0;
|
8
|
+
padding: 0;
|
9
|
+
box-sizing: border-box;
|
10
|
+
}
|
11
|
+
html{
|
12
|
+
height: 100%;
|
13
|
+
}
|
14
|
+
body{
|
15
|
+
font-family: 'Segoe UI', sans-serif;;
|
16
|
+
font-size: 1rem;
|
17
|
+
line-height: 1.6;
|
18
|
+
height: 100%;
|
19
|
+
}
|
20
|
+
p{
|
21
|
+
padding-bottom: 5px;
|
22
|
+
}
|
23
|
+
.wrap {
|
24
|
+
width: 100%;
|
25
|
+
height: 100%;
|
26
|
+
display: flex;
|
27
|
+
justify-content: center;
|
28
|
+
align-items: center;
|
29
|
+
background: #fafafa;
|
30
|
+
}
|
31
|
+
.login-form{
|
32
|
+
width: 350px;
|
33
|
+
margin: 0 auto;
|
34
|
+
border: 1px solid #ddd;
|
35
|
+
padding: 2rem;
|
36
|
+
background: #ffffff;
|
37
|
+
}
|
38
|
+
.form-input{
|
39
|
+
background: #fafafa;
|
40
|
+
border: 1px solid #eeeeee;
|
41
|
+
padding: 12px;
|
42
|
+
width: 100%;
|
43
|
+
}
|
44
|
+
.form-group{
|
45
|
+
margin-bottom: 1rem;
|
46
|
+
}
|
47
|
+
.form-button{
|
48
|
+
background: #69d2e7;
|
49
|
+
border: 1px solid #ddd;
|
50
|
+
color: #ffffff;
|
51
|
+
padding: 10px;
|
52
|
+
width: 100%;
|
53
|
+
text-transform: uppercase;
|
54
|
+
}
|
55
|
+
.form-button:hover{
|
56
|
+
background: #69c8e7;
|
57
|
+
}
|
58
|
+
.form-header{
|
59
|
+
text-align: center;
|
60
|
+
margin-bottom : 2rem;
|
61
|
+
}
|
62
|
+
.form-footer{
|
63
|
+
text-align: center;
|
64
|
+
}
|
65
|
+
</style>
|
66
|
+
</head>
|
67
|
+
<body>
|
68
|
+
<div class="wrap">
|
69
|
+
<form class="login-form" action="/login" method="post">
|
70
|
+
{% module xsrf_form_html() %}
|
71
|
+
<div class="form-header">
|
72
|
+
<h3><img src="https://static.bokeh.org/logos/logotype.svg"></h3>
|
73
|
+
<p> Login to access your application</p>
|
74
|
+
</div>
|
75
|
+
<!--Email Input-->
|
76
|
+
<div class="form-group">
|
77
|
+
<input name="username" type="text" class="form-input" autocapitalize="off" autocorrect="off" placeholder="username">
|
78
|
+
</div>
|
79
|
+
<!--Password Input-->
|
80
|
+
<div class="form-group">
|
81
|
+
<input name="password" type="password" class="form-input" placeholder="password">
|
82
|
+
</div>
|
83
|
+
<!--Login Button-->
|
84
|
+
<div class="form-group">
|
85
|
+
<button class="form-button" type="submit">Login</button>
|
86
|
+
</div>
|
87
|
+
<span class="errormessage">{{errormessage}}</span>
|
88
|
+
<div><small>
|
89
|
+
<p>This is a <b>toy example</b> that demonstrates the authentication building blocks that are available with a Bokeh server.</p>
|
90
|
+
|
91
|
+
<p>You can log in with user: <b><i>bokeh</i></b> / pass: <b><i>bokeh</i></b></p>
|
92
|
+
|
93
|
+
<p><a href="https://docs.bokeh.org/en/latest/docs/user_guide/server/deploy.html#authentication">See the documentation</a> for a full discussion.</p>
|
94
|
+
</small></div>
|
95
|
+
</form>
|
96
|
+
</div>
|
97
|
+
</body>
|
98
|
+
</html>
|
@@ -719,16 +719,16 @@ class ConfigManager(object):
|
|
719
719
|
self._info("{} has been removed.".format(configFile))
|
720
720
|
self._info("The default configuration will be loaded next time..")
|
721
721
|
|
722
|
-
def configure(self, editConfigMethod):
|
722
|
+
def configure(self, editConfigMethod, prompt="Enter 'E' to edit a parameter, or 'Q' to quit", editCharacters = 'E', quitCharacters= 'Q'):
|
723
723
|
"""@brief A helper method to edit the dictionary config.
|
724
724
|
@param editConfigMethod The method to call to edit configuration.
|
725
725
|
@return None"""
|
726
726
|
running=True
|
727
727
|
while running:
|
728
728
|
idKeyDict=self.show()
|
729
|
-
response = self._uio.getInput(
|
729
|
+
response = self._uio.getInput(prompt)
|
730
730
|
response=response.upper()
|
731
|
-
if response
|
731
|
+
if response in editCharacters:
|
732
732
|
id = self._uio.getIntInput("Enter the ID of the parameter to change")
|
733
733
|
if id not in idKeyDict:
|
734
734
|
self._uio.error("Configuration ID {} is invalid.".format(id))
|
@@ -737,7 +737,7 @@ class ConfigManager(object):
|
|
737
737
|
editConfigMethod(key)
|
738
738
|
self.store()
|
739
739
|
|
740
|
-
elif response
|
740
|
+
elif response in quitCharacters:
|
741
741
|
running = False
|
742
742
|
|
743
743
|
def show(self):
|
p3lib-1.1.107/PKG-INFO
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.2
|
2
|
-
Name: p3lib
|
3
|
-
Version: 1.1.107
|
4
|
-
Summary: A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
5
|
-
Home-page: https://github.com/pjaos/p3lib
|
6
|
-
Author: Paul Austen
|
7
|
-
Author-email: pausten.os@gmail.com
|
8
|
-
Project-URL: Bug Tracker, https://github.com/pjaos/p3lib/issues
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
11
|
-
Classifier: Operating System :: OS Independent
|
12
|
-
Requires-Python: >=3.8
|
13
|
-
Description-Content-Type: text/markdown
|
14
|
-
License-File: LICENSE
|
15
|
-
Requires-Dist: paramiko>=2.9.3
|
16
|
-
Requires-Dist: pillow>=9.2.0
|
17
|
-
|
18
|
-
# A Python3 library
|
19
|
-
A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
20
|
-
|
21
|
-
## Installation
|
22
|
-
p3lib is available on pypi and can be installed using the following command.
|
23
|
-
|
24
|
-
```
|
25
|
-
pip3 install p3lib
|
26
|
-
```
|
p3lib-1.1.107/pyproject.toml
DELETED
p3lib-1.1.107/setup.cfg
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
[metadata]
|
2
|
-
name = p3lib
|
3
|
-
version = 1.1.107
|
4
|
-
author = Paul Austen
|
5
|
-
author_email = pausten.os@gmail.com
|
6
|
-
description = A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
7
|
-
long_description = file: README.md
|
8
|
-
long_description_content_type = text/markdown
|
9
|
-
url = https://github.com/pjaos/p3lib
|
10
|
-
project_urls =
|
11
|
-
Bug Tracker = https://github.com/pjaos/p3lib/issues
|
12
|
-
classifiers =
|
13
|
-
Programming Language :: Python :: 3
|
14
|
-
License :: OSI Approved :: MIT License
|
15
|
-
Operating System :: OS Independent
|
16
|
-
|
17
|
-
[options]
|
18
|
-
package_dir =
|
19
|
-
= src
|
20
|
-
packages = find:
|
21
|
-
python_requires = >=3.8
|
22
|
-
install_requires =
|
23
|
-
paramiko>=2.9.3
|
24
|
-
pillow>=9.2.0
|
25
|
-
|
26
|
-
[options.packages.find]
|
27
|
-
where = src
|
28
|
-
|
29
|
-
[egg_info]
|
30
|
-
tag_build =
|
31
|
-
tag_date = 0
|
32
|
-
|
@@ -1,26 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.2
|
2
|
-
Name: p3lib
|
3
|
-
Version: 1.1.107
|
4
|
-
Summary: A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
5
|
-
Home-page: https://github.com/pjaos/p3lib
|
6
|
-
Author: Paul Austen
|
7
|
-
Author-email: pausten.os@gmail.com
|
8
|
-
Project-URL: Bug Tracker, https://github.com/pjaos/p3lib/issues
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
11
|
-
Classifier: Operating System :: OS Independent
|
12
|
-
Requires-Python: >=3.8
|
13
|
-
Description-Content-Type: text/markdown
|
14
|
-
License-File: LICENSE
|
15
|
-
Requires-Dist: paramiko>=2.9.3
|
16
|
-
Requires-Dist: pillow>=9.2.0
|
17
|
-
|
18
|
-
# A Python3 library
|
19
|
-
A group of python modules for networking, plotting data, config storage, automating boot scripts, ssh access and user input output.
|
20
|
-
|
21
|
-
## Installation
|
22
|
-
p3lib is available on pypi and can be installed using the following command.
|
23
|
-
|
24
|
-
```
|
25
|
-
pip3 install p3lib
|
26
|
-
```
|
@@ -1,32 +0,0 @@
|
|
1
|
-
LICENSE
|
2
|
-
README.md
|
3
|
-
pyproject.toml
|
4
|
-
setup.cfg
|
5
|
-
src/p3lib/__init__.py
|
6
|
-
src/p3lib/ate.py
|
7
|
-
src/p3lib/bokeh_auth.py
|
8
|
-
src/p3lib/bokeh_gui.py
|
9
|
-
src/p3lib/boot_manager.py
|
10
|
-
src/p3lib/conduit.py
|
11
|
-
src/p3lib/database_if.py
|
12
|
-
src/p3lib/file_io.py
|
13
|
-
src/p3lib/gnome_desktop_app.py
|
14
|
-
src/p3lib/helper.py
|
15
|
-
src/p3lib/json_networking.py
|
16
|
-
src/p3lib/mqtt_rpc.py
|
17
|
-
src/p3lib/netif.py
|
18
|
-
src/p3lib/netplotly.py
|
19
|
-
src/p3lib/ngt.py
|
20
|
-
src/p3lib/pconfig.py
|
21
|
-
src/p3lib/ssh.py
|
22
|
-
src/p3lib/table_plot.py
|
23
|
-
src/p3lib/uio.py
|
24
|
-
src/p3lib.egg-info/PKG-INFO
|
25
|
-
src/p3lib.egg-info/SOURCES.txt
|
26
|
-
src/p3lib.egg-info/dependency_links.txt
|
27
|
-
src/p3lib.egg-info/requires.txt
|
28
|
-
src/p3lib.egg-info/top_level.txt
|
29
|
-
tests/test_conduit.py
|
30
|
-
tests/test_json_networking.py
|
31
|
-
tests/test_netif.py
|
32
|
-
tests/test_ssh.py
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
p3lib
|
@@ -1,41 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
|
3
|
-
import unittest
|
4
|
-
|
5
|
-
import sys
|
6
|
-
from p3lib.conduit import Conduit
|
7
|
-
|
8
|
-
class ConduitTester(unittest.TestCase):
|
9
|
-
"""@brief Test cases for the Conduit class"""
|
10
|
-
|
11
|
-
def setUp(self):
|
12
|
-
self.conduit = Conduit()
|
13
|
-
|
14
|
-
def tearDown(self):
|
15
|
-
pass
|
16
|
-
|
17
|
-
def test1_AToB(self):
|
18
|
-
msg = "test1_AToB_Message"
|
19
|
-
self.conduit.putA(msg)
|
20
|
-
|
21
|
-
self.assertTrue( self.conduit.bReadAvailable() )
|
22
|
-
|
23
|
-
rxMsg = self.conduit.getB()
|
24
|
-
self.assertTrue( msg == rxMsg)
|
25
|
-
|
26
|
-
def test1_BToA(self):
|
27
|
-
msg = "test1_BToA_Message"
|
28
|
-
self.conduit.putB(msg)
|
29
|
-
|
30
|
-
self.assertTrue( self.conduit.aReadAvailable() )
|
31
|
-
|
32
|
-
rxMsg = self.conduit.getA()
|
33
|
-
self.assertTrue( msg == rxMsg)
|
34
|
-
|
35
|
-
def main():
|
36
|
-
"""@brief Unit tests for the UIO class"""
|
37
|
-
suite = unittest.TestLoader().loadTestsFromTestCase(ConduitTester)
|
38
|
-
unittest.TextTestRunner(verbosity=2).run(suite)
|
39
|
-
|
40
|
-
if __name__ == '__main__':
|
41
|
-
main()
|
@@ -1,100 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
|
3
|
-
from time import sleep
|
4
|
-
from p3lib.json_networking import JSONServer, JsonServerHandler, JSONClient
|
5
|
-
import threading
|
6
|
-
|
7
|
-
class ServerSessionHandler(JsonServerHandler):
|
8
|
-
#handler that sends data back to src
|
9
|
-
def handle(self):
|
10
|
-
try:
|
11
|
-
while True:
|
12
|
-
rxDict = self.rx()
|
13
|
-
self.tx(self.request, rxDict)
|
14
|
-
|
15
|
-
except:
|
16
|
-
pass
|
17
|
-
|
18
|
-
class TestClass:
|
19
|
-
"""@brief Test the json_networking class byt setting up a server sending data to is and checking the data we get back
|
20
|
-
what we sent."""
|
21
|
-
HOST = "localhost"
|
22
|
-
PORT = 9999
|
23
|
-
APASSWORD = "300fkslaa"
|
24
|
-
MIN_ID = 0
|
25
|
-
MAX_ID = 100
|
26
|
-
ID_STR = "ID"
|
27
|
-
|
28
|
-
@classmethod
|
29
|
-
def setup_class(cls):
|
30
|
-
server = JSONServer((TestClass.HOST, TestClass.PORT), ServerSessionHandler)
|
31
|
-
serverThread = threading.Thread(target=server.serve_forever)
|
32
|
-
serverThread.daemon = True
|
33
|
-
serverThread.start()
|
34
|
-
|
35
|
-
def test_connect(self):
|
36
|
-
client = JSONClient(TestClass.HOST, TestClass.PORT)
|
37
|
-
|
38
|
-
def test_tx(self):
|
39
|
-
client = JSONClient(TestClass.HOST, TestClass.PORT)
|
40
|
-
txDict = {"password": "apassword"}
|
41
|
-
client.tx(txDict)
|
42
|
-
|
43
|
-
def test_rx(self):
|
44
|
-
client = JSONClient(TestClass.HOST, TestClass.PORT)
|
45
|
-
|
46
|
-
txDict = {"password": TestClass.APASSWORD}
|
47
|
-
client.tx(txDict)
|
48
|
-
|
49
|
-
rxDict = client.rx()
|
50
|
-
assert( "password" in rxDict)
|
51
|
-
value = rxDict["password"]
|
52
|
-
assert( value == TestClass.APASSWORD )
|
53
|
-
|
54
|
-
def txThread(self, client):
|
55
|
-
for id in range(TestClass.MIN_ID, TestClass.MAX_ID):
|
56
|
-
txDict = {TestClass.ID_STR: id}
|
57
|
-
client.tx(txDict)
|
58
|
-
|
59
|
-
def test_tx_multiple(self):
|
60
|
-
client = JSONClient(TestClass.HOST, TestClass.PORT)
|
61
|
-
txThread = threading.Thread(target=self.txThread, args=(client,) )
|
62
|
-
txThread.start()
|
63
|
-
for id in range(TestClass.MIN_ID, TestClass.MAX_ID):
|
64
|
-
txDict = {TestClass.ID_STR: id}
|
65
|
-
client.tx(txDict)
|
66
|
-
|
67
|
-
def test_rx_multiple(self):
|
68
|
-
client = JSONClient(TestClass.HOST, TestClass.PORT)
|
69
|
-
txThread = threading.Thread(target=self.txThread, args=(client,) )
|
70
|
-
txThread.start()
|
71
|
-
|
72
|
-
expectedID=TestClass.MIN_ID
|
73
|
-
while True:
|
74
|
-
rxDict = client.rx()
|
75
|
-
assert(TestClass.ID_STR in rxDict)
|
76
|
-
id = rxDict[TestClass.ID_STR]
|
77
|
-
assert( id == expectedID )
|
78
|
-
expectedID=expectedID+1
|
79
|
-
if expectedID == TestClass.MAX_ID:
|
80
|
-
break
|
81
|
-
|
82
|
-
client.close()
|
83
|
-
|
84
|
-
def test_rx_multiple_non_blocking(self):
|
85
|
-
client = JSONClient(TestClass.HOST, TestClass.PORT)
|
86
|
-
txThread = threading.Thread(target=self.txThread, args=(client,))
|
87
|
-
txThread.start()
|
88
|
-
|
89
|
-
expectedID = TestClass.MIN_ID
|
90
|
-
while True:
|
91
|
-
rxDict = client.rx(blocking=False)
|
92
|
-
if rxDict:
|
93
|
-
assert (TestClass.ID_STR in rxDict)
|
94
|
-
id = rxDict[TestClass.ID_STR]
|
95
|
-
assert (id == expectedID)
|
96
|
-
expectedID = expectedID + 1
|
97
|
-
if expectedID == TestClass.MAX_ID:
|
98
|
-
break
|
99
|
-
|
100
|
-
client.close()
|
@@ -1,79 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
|
3
|
-
from time import sleep
|
4
|
-
from p3lib.netif import NetIF
|
5
|
-
|
6
|
-
#These must be changed to use an interface on the local machine.
|
7
|
-
NET_IF = "enx0c37960803fc"
|
8
|
-
IP_ADDRESS = "192.168.0.10"
|
9
|
-
NETMASK = "255.255.255.0"
|
10
|
-
|
11
|
-
class TestClass:
|
12
|
-
"""@brief Test the NEtIF class."""
|
13
|
-
|
14
|
-
def test_ip_in_network(self):
|
15
|
-
assert( NetIF.IsAddressInNetwork("192.168.1.123", "192.168.1.0/24") )
|
16
|
-
|
17
|
-
def test_ip_not_in_network(self):
|
18
|
-
assert( not NetIF.IsAddressInNetwork("192.168.1.123", "192.168.2.0/24") )
|
19
|
-
|
20
|
-
def test_IPStr2int_0(self):
|
21
|
-
intValue = NetIF.IPStr2int("0.0.0.0")
|
22
|
-
assert( intValue == 0 )
|
23
|
-
|
24
|
-
def test_IPStr2int_f(self):
|
25
|
-
intValue = NetIF.IPStr2int("255.255.255.255")
|
26
|
-
assert( intValue == 0xffffffff )
|
27
|
-
|
28
|
-
def test_IPStr2int_v(self):
|
29
|
-
intValue = NetIF.IPStr2int("192.168.1.1")
|
30
|
-
assert( intValue == 0xc0a80101 )
|
31
|
-
|
32
|
-
def test_Int2IPStr_0(self):
|
33
|
-
strValue = NetIF.Int2IPStr(0)
|
34
|
-
assert( strValue == "0.0.0.0" )
|
35
|
-
|
36
|
-
def test_Int2IPStr_f(self):
|
37
|
-
strValue = NetIF.Int2IPStr(0xffffffff)
|
38
|
-
assert( strValue == "255.255.255.255" )
|
39
|
-
|
40
|
-
def test_Int2IPStr_v(self):
|
41
|
-
strValue = NetIF.Int2IPStr(0xc0a80101)
|
42
|
-
assert( strValue == "192.168.1.1" )
|
43
|
-
|
44
|
-
def test_NetmaskToBitCount(self):
|
45
|
-
assert( NetIF.NetmaskToBitCount("255.255.255.0") == 24 )
|
46
|
-
|
47
|
-
def test_getIFDict(self):
|
48
|
-
netif = NetIF()
|
49
|
-
ifDict = netif.getIFDict()
|
50
|
-
|
51
|
-
def test_checkSupportedOS(self):
|
52
|
-
netif = NetIF()
|
53
|
-
netif._checkSupportedOS()
|
54
|
-
|
55
|
-
def test_getIFName(self):
|
56
|
-
netif = NetIF()
|
57
|
-
#This requires the machine has an interface on the IP_ADDRESS/24 network
|
58
|
-
ifName = netif.getIFName(IP_ADDRESS)
|
59
|
-
assert( ifName == NET_IF)
|
60
|
-
|
61
|
-
ifName = netif.getIFName("1.1.1.1")
|
62
|
-
assert( ifName == None )
|
63
|
-
|
64
|
-
def test_getIFNetmask(self):
|
65
|
-
netif = NetIF()
|
66
|
-
#This requires the machine has an interface named MACHINE_NET_IF
|
67
|
-
nm = netif.getIFNetmask(NET_IF)
|
68
|
-
assert( nm == NETMASK )
|
69
|
-
|
70
|
-
def test_getIFIPAddress(self):
|
71
|
-
netif = NetIF()
|
72
|
-
ipAddr = netif.getIFIPAddress(NET_IF)
|
73
|
-
assert( ipAddr == IP_ADDRESS )
|
74
|
-
|
75
|
-
def test_getLocalNetworkAddress(self):
|
76
|
-
netif = NetIF()
|
77
|
-
ipAddr = netif.getLocalNetworkAddress()
|
78
|
-
assert( ipAddr == IP_ADDRESS )
|
79
|
-
|
p3lib-1.1.107/tests/test_ssh.py
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python3
|
2
|
-
|
3
|
-
import unittest
|
4
|
-
from time import sleep
|
5
|
-
|
6
|
-
# Supress the following warning
|
7
|
-
# CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from this module in 48.0.0.
|
8
|
-
import warnings
|
9
|
-
from cryptography.utils import CryptographyDeprecationWarning
|
10
|
-
with warnings.catch_warnings(action="ignore", category=CryptographyDeprecationWarning):
|
11
|
-
import paramiko
|
12
|
-
|
13
|
-
from p3lib.uio import UIO
|
14
|
-
from p3lib.ssh import SSH, SSHTunnelManager
|
15
|
-
|
16
|
-
#An ssh login on an ssh server must be available for these test to run.
|
17
|
-
USERNAME="pja"
|
18
|
-
SERVER="localhost"
|
19
|
-
|
20
|
-
class SSHTester(unittest.TestCase):
|
21
|
-
"""@brief Unit tests for the UIO class"""
|
22
|
-
|
23
|
-
def setUp(self):
|
24
|
-
"""@brief To test correctly the ssh key should be removed from the server
|
25
|
-
The user will be asked to enter a password and the connect will succeed.
|
26
|
-
The next time the user should be able to login without a password."""
|
27
|
-
self._uio = UIO()
|
28
|
-
uio = UIO()
|
29
|
-
self.ssh = SSH(SERVER, USERNAME, uio=uio)
|
30
|
-
|
31
|
-
def tearDown(self):
|
32
|
-
self.ssh.close()
|
33
|
-
|
34
|
-
def test1_connect(self):
|
35
|
-
self.ssh.connect()
|
36
|
-
|
37
|
-
def test2_put(self):
|
38
|
-
localFile = "/tmp/pushFile.txt"
|
39
|
-
remoteFile = "/tmp/pushedFile.txt"
|
40
|
-
fd = open(localFile, 'w')
|
41
|
-
fd.write("1234\n")
|
42
|
-
fd.close()
|
43
|
-
|
44
|
-
self.ssh.connect(connectSFTPSession=True)
|
45
|
-
self.ssh.putFile(localFile, remoteFile)
|
46
|
-
|
47
|
-
def test3_get(self):
|
48
|
-
localFile = "/tmp/pulledFile.txt"
|
49
|
-
remoteFile = "/tmp/pushedFile.txt"
|
50
|
-
fd = open(localFile, 'w')
|
51
|
-
fd.write("1234\n")
|
52
|
-
fd.close()
|
53
|
-
|
54
|
-
self.ssh.connect(connectSFTPSession=True)
|
55
|
-
self.ssh.getFile(remoteFile, localFile)
|
56
|
-
|
57
|
-
def test4_fwdTunnel(self):
|
58
|
-
self.ssh.connect()
|
59
|
-
sshTunnelManager = SSHTunnelManager(self._uio, self.ssh, True)
|
60
|
-
sshTunnelManager.startFwdSSHTunnel(30000, SERVER, 22)
|
61
|
-
|
62
|
-
def test5_revTunnel(self):
|
63
|
-
self.ssh.connect()
|
64
|
-
sshTunnelManager = SSHTunnelManager(self._uio, self.ssh, True)
|
65
|
-
sshTunnelManager.startRevSSHTunnel(30000, SERVER, 22)
|
66
|
-
|
67
|
-
def main():
|
68
|
-
"""@brief Unit tests for the UIO class"""
|
69
|
-
suite = unittest.TestLoader().loadTestsFromTestCase(SSHTester)
|
70
|
-
unittest.TextTestRunner(verbosity=2).run(suite)
|
71
|
-
|
72
|
-
if __name__ == '__main__':
|
73
|
-
main()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|