Skip to content

Commit 749521d

Browse files
author
Douglas Pew
committed
Fixed bulkio test to use SigTest waveform
1 parent c0c0630 commit 749521d

File tree

2 files changed

+34
-16
lines changed

2 files changed

+34
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
apps/*
22
.virtualenv/
3+
*pyc

tests/bulkio.py

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,47 @@
3636

3737
# application imports
3838
from pyrest import Application
39+
from base import JsonTests
40+
from defaults import Default
3941

4042
# all method returning suite is required by tornado.testing.main()
4143
#def all():
4244
# return unittest.TestLoader().loadTestsFromModule(__import__(__name__))
4345

4446

45-
class BulkIOTests(AsyncHTTPTestCase, LogTrapTestCase):
47+
class BulkIOTests(JsonTests, AsyncHTTPTestCase, LogTrapTestCase):
4648

4749
# def setUp(self):
4850
# super(RESTfulTest, self).setUp()
4951
# rtl_app.RTLApp('REDHAWK_DEV').stop_survey()
5052

53+
def setUp(self):
54+
super(JsonTests, self).setUp()
55+
json, resp = self._json_request(
56+
'/domains/%s/applications' % Default.DOMAIN_NAME,
57+
200,
58+
'POST',
59+
{'name': Default.WAVEFORM,
60+
'started': True }
61+
)
62+
self.assertTrue('launched' in json)
63+
self.base_url = '/domains/%s/applications/%s' % (Default.DOMAIN_NAME, json['launched'])
64+
65+
json, resp = self._json_request(self.base_url, 200)
66+
self.assertList(json, 'components')
67+
self.assertTrue(json['components'])
68+
69+
self.components = json['components']
70+
71+
def tearDown(self):
72+
self._json_request(
73+
self.base_url,
74+
200,
75+
'DELETE'
76+
)
77+
super(BulkIOTests, self).tearDown()
78+
79+
5180

5281
def get_app(self):
5382
return Application(debug=True, _ioloop=self.io_loop)
@@ -57,23 +86,11 @@ def test_bulkio_ws(self):
5786

5887
# NOTE: A timeout means the website took too long to respond
5988
# it could mean that bulkio port is not sending data
60-
61-
response = yield AsyncHTTPClient(self.io_loop).fetch(self.get_url('/redhawk/rest/domains/REDHAWK_DEV/applications'))
62-
self.assertEquals(200, response.code)
63-
data = json.loads(response.body)
64-
wid = next((wf['id'] for wf in data['applications'] if wf['name'].startswith('Rtl_FM')), None)
65-
if not wid:
66-
self.fail('Unable to find RTL Waveform')
67-
68-
response = yield AsyncHTTPClient(self.io_loop).fetch(self.get_url("/redhawk/rest/domains/REDHAWK_DEV/applications/%s/components/"%wid))
69-
self.assertEquals(200, response.code)
70-
data = json.loads(response.body)
71-
72-
cid = next((cp['id'] for cp in data['components'] if cp['name'] == 'NOOP'), None)
89+
cid = next((cp['id'] for cp in self.components if cp['name'] == 'SigGen'), None)
7390
if not cid:
74-
self.fail('Unable to find NOOP component')
91+
self.fail('Unable to find SigGen component')
7592

76-
url = self.get_url("/redhawk/rest/domains/REDHAWK_DEV/applications/%s/components/%s/ports/dataFloat_out/bulkio"%(wid,cid)).replace('http','ws')
93+
url = self.get_url("%s/components/%s/ports/out/bulkio"%(Default.REST_BASE+self.base_url,cid)).replace('http','ws')
7794
conn1 = yield websocket.websocket_connect(url,
7895
io_loop=self.io_loop)
7996

0 commit comments

Comments
 (0)