def test_get_transmitter_devices(self, fix_registered): "Test getting devices of a known transmitter." from relayr import Client from relayr.resources import Transmitter token = fix_registered.testset1['token'] transmitterID = fix_registered.testset1['transmitterID'] c = Client(token=token) t = Transmitter(id=transmitterID, client=c) t.get_info() assert t.name == fix_registered.testset1['transmitterName'] devs = t.get_connected_devices() assert len(list(devs)) == 6
def test_get_wunderbar(self, fix_registered): "Test get info about the user's newly registered wunderbar." from relayr import Client token = fix_registered.testset1['token'] c = Client(token=token) user_info = c.api.get_oauth2_user_info() wb_dev_info = c.api.post_user_wunderbar(user_info['id']) assert len(wb_dev_info) == 7 # 6 sensors plus one transmitter owner_ids = [dev['owner'] for dev in wb_dev_info.values()] assert len(set(owner_ids)) == 1 assert user_info['id'] == owner_ids[0] for typ, info in wb_dev_info.items(): for key in 'owner name id'.split(): # plus others... assert key in info # now clean-up from relayr.resources import Transmitter t_id = wb_dev_info['masterModule']['id'] t = Transmitter(id=t_id, client=c) for dev in t.get_connected_devices(): dev.delete() t.delete()