Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
opcua-asyncio
Commits
7d5c0c85
Commit
7d5c0c85
authored
Jul 07, 2015
by
Olivier R-D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add set_read_only, add tests
parent
65d5355e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
opcua/node.py
opcua/node.py
+3
-0
tests.py
tests.py
+15
-2
No files found.
opcua/node.py
View file @
7d5c0c85
...
...
@@ -203,6 +203,9 @@ class Node(object):
self
.
set_attribute
(
ua
.
AttributeIds
.
WriteMask
,
ua
.
DataValue
(
ua
.
OpenFileMode
.
Read
))
self
.
set_attribute
(
ua
.
AttributeIds
.
UserWriteMask
,
ua
.
DataValue
(
ua
.
OpenFileMode
.
Read
))
def
set_read_only
(
self
):
return
self
.
set_writable
(
False
)
def
set_attribute
(
self
,
attributeid
,
datavalue
):
"""
Set an attribute of a node
...
...
tests.py
View file @
7d5c0c85
...
...
@@ -670,14 +670,27 @@ class AdminTestClient(unittest.TestCase, CommonTests):
with
self
.
assertRaises
(
Exception
):
self
.
clt
.
bclient
.
_send_request
(
request
)
def
test_
ro_object
s
(
self
):
def
test_
objects_anonymou
s
(
self
):
objects
=
self
.
ro_clt
.
get_objects_node
()
with
self
.
assertRaises
(
Exception
):
objects
.
set_attribute
(
ua
.
AttributeIds
.
WriteMask
,
ua
.
DataValue
(
999
))
with
self
.
assertRaises
(
Exception
):
f
=
objects
.
add_folder
(
3
,
'MyFolder'
)
def
test_ro_variable
(
self
):
def
test_folder_anonymous
(
self
):
objects
=
self
.
clt
.
get_objects_node
()
f
=
objects
.
add_folder
(
3
,
'MyFolderRO'
)
f_ro
=
self
.
ro_clt
.
get_node
(
f
.
nodeid
)
self
.
assertEqual
(
f
,
f_ro
)
with
self
.
assertRaises
(
Exception
):
f2
=
f_ro
.
add_folder
(
3
,
'MyFolder2'
)
f
.
set_writable
(
True
)
f3
=
f_ro
.
add_folder
(
3
,
'MyFolder3'
)
f
.
set_read_only
()
with
self
.
assertRaises
(
Exception
):
f4
=
f_ro
.
add_folder
(
3
,
'MyFolder4'
)
def
test_variable_anonymous
(
self
):
objects
=
self
.
clt
.
get_objects_node
()
v
=
objects
.
add_variable
(
3
,
'MyROVariable'
,
6
)
v
.
set_value
(
4
)
#this should work
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment