Completed
Push — master ( 52b12e...458b63 )
by Olivier
59s
created

TestClient.tearDown()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
1
2
import unittest
3
import sys
4
print("SYS:PATH", sys.path)
5
sys.path.insert(0, "python-opcua")
6
sys.path.insert(0, "opcua-widgets")
7
import os
8
print("PWD", os.getcwd())
9
10
from opcua import ua
11
from opcua import Server
12
13
from PyQt5.QtCore import QTimer, QSettings, QModelIndex, Qt, QCoreApplication
14
from PyQt5.QtWidgets import QApplication
15
from PyQt5.QtTest import QTest
16
17
from uaclient.mainwindow import Window
18
19
20
class TestClient(unittest.TestCase):
21
    def setUp(self):
22
        self.server = Server()
23
        url = "opc.tcp://localhost:48400/freeopcua/server/"
24
        self.server.set_endpoint(url)
25
        self.server.start()
26
        self.client = Window()
27
        self.client.ui.addrComboBox.setCurrentText(url)
28
        self.client.connect()
29
30
    def tearDown(self):
31
        self.client.disconnect()
32
        self.server.stop()
33
34
    def test_select_objects(self):
35
        objects = self.server.nodes.objects
36
        self.client.tree_ui.set_current_node("Objects")
37
        self.assertEqual(objects, self.client.tree_ui.get_current_node())
38
39
40
41
if __name__ == "__main__":
42
    app = QApplication(sys.argv)
43
    unittest.main()
44
45
46