Пример #1
0
 def to_profiles(self):
     """Get all of the profiles that this generates."""
     gp = gm.GenerationReadingProfile()
     equipment = gp.generatingUnit.conductingEquipment
     equipment.mRID = str(self.mrid)
     equipment.namedObject.name.value = self.name
     gp.generationReading.CopyFrom(self.to_generation_reading())
     yield gp
async def test_nats_publisher_publish():
    system = SimulatedSystem()
    loop = asyncio.get_event_loop()
    mock_nats = MockNats()
    publisher = NatsPublisher([], system, loop, mock_nats)

    await publisher.start()

    profile = gm.GenerationReadingProfile()
    publisher.publish_async(profile)
Пример #3
0
def test_publish_async(test_app):
    client_queue = asyncio.Queue()
    test_app.clients.add(client_queue)
    profile = gm.GenerationReadingProfile()
    publish_async((None, None, profile))
    assert client_queue.empty() is False