Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ipaaca
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ramin Yaghoubzadeh Torky
ipaaca
Commits
8c07170d
Commit
8c07170d
authored
13 years ago
by
Ramin Yaghoubzadeh
Browse files
Options
Downloads
Patches
Plain Diff
Added 2 good and 2 broken tests, you are welcome
parent
64d74419
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/test/src/testipaaca.py
+26
-11
26 additions, 11 deletions
python/test/src/testipaaca.py
with
26 additions
and
11 deletions
python/test/src/testipaaca.py
+
26
−
11
View file @
8c07170d
...
...
@@ -64,6 +64,21 @@ class IpaacaCommitTestCases(unittest.TestCase):
time
.
sleep
(
0.1
)
received_iu
=
self
.
ib
.
iu_store
[
self
.
iu
.
uid
]
self
.
assertTrue
(
received_iu
.
committed
)
def
testCommitAndLocalWrite
(
self
):
self
.
ob
.
add
(
self
.
iu
)
time
.
sleep
(
0.1
)
self
.
iu
.
commit
()
with
self
.
assertRaises
(
ipaaca
.
IUCommittedError
):
self
.
iu
.
payload
[
'
data
'
]
=
'
updatedData
'
def
testCommitAndRemoteWrite
(
self
):
self
.
ob
.
add
(
self
.
iu
)
time
.
sleep
(
0.1
)
self
.
iu
.
commit
()
received_iu
=
self
.
ib
.
iu_store
[
self
.
iu
.
uid
]
with
self
.
assertRaises
(
ipaaca
.
IUCommittedError
):
received_iu
.
payload
[
'
data
'
]
=
'
updatedData
'
class
IpaacaLinksTestCase
(
unittest
.
TestCase
):
...
...
@@ -130,27 +145,27 @@ class IpaacaRemoteWriteTestCase(unittest.TestCase):
self
.
ib
=
ipaaca
.
InputBuffer
(
'
TestIn
'
,
[
'
sensorcategory
'
])
self
.
ib
.
register_handler
(
handle_iu_event
)
self
.
ob
=
ipaaca
.
OutputBuffer
(
'
TestOut
'
)
self
.
sensor_
iu
=
ipaaca
.
IU
(
'
sensorcategory
'
)
self
.
sensor_
iu
.
payload
=
{
'
data
'
:
'
sensordata
'
}
self
.
iu
=
ipaaca
.
IU
(
'
sensorcategory
'
)
self
.
iu
.
payload
=
{
'
data
'
:
'
sensordata
'
}
time
.
sleep
(
0.1
)
self
.
ob
.
add
(
self
.
sensor_
iu
)
self
.
ob
.
add
(
self
.
iu
)
time
.
sleep
(
0.1
)
def
tearDown
(
self
):
pass
def
testRemotePayloadChange
(
self
):
self
.
assertIn
(
self
.
sensor_
iu
.
uid
,
self
.
ib
.
iu_store
)
received_iu
=
self
.
ib
.
iu_store
[
self
.
sensor_
iu
.
uid
]
self
.
assertIn
(
self
.
iu
.
uid
,
self
.
ib
.
iu_store
)
received_iu
=
self
.
ib
.
iu_store
[
self
.
iu
.
uid
]
received_iu
.
payload
[
'
data
'
]
=
'
updatedData
'
time
.
sleep
(
0.1
)
self
.
assertEqual
(
self
.
sensor_
iu
.
payload
[
'
data
'
],
'
updatedData
'
)
self
.
assertEqual
(
self
.
iu
.
payload
[
'
data
'
],
'
updatedData
'
)
def
testRemotePayloadReplace
(
self
):
self
.
assertIn
(
self
.
sensor_
iu
.
uid
,
self
.
ib
.
iu_store
)
received_iu
=
self
.
ib
.
iu_store
[
self
.
sensor_
iu
.
uid
]
self
.
assertIn
(
self
.
iu
.
uid
,
self
.
ib
.
iu_store
)
received_iu
=
self
.
ib
.
iu_store
[
self
.
iu
.
uid
]
received_iu
.
payload
=
{
'
key1
'
:
'
value1
'
,
'
key2
'
:
'
value2
'
}
time
.
sleep
(
0.1
)
self
.
assertEqual
(
len
(
self
.
sensor_
iu
.
payload
),
2
)
self
.
assertEqual
(
self
.
sensor_
iu
.
payload
[
'
key1
'
],
'
value1
'
)
self
.
assertEqual
(
self
.
sensor_
iu
.
payload
[
'
key2
'
],
'
value2
'
)
self
.
assertEqual
(
len
(
self
.
iu
.
payload
),
2
)
self
.
assertEqual
(
self
.
iu
.
payload
[
'
key1
'
],
'
value1
'
)
self
.
assertEqual
(
self
.
iu
.
payload
[
'
key2
'
],
'
value2
'
)
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment