Example #1
0
def test_client_record_now():
    with patch('compoundpi.client.CompoundPiServerList.transact') as l, \
            patch('compoundpi.client.CompoundPiDownloadServer'):
        l.return_value = {
            compoundpi.client.IPv4Address('192.168.0.1'): None,
            compoundpi.client.IPv4Address('192.168.0.2'): None,
        }
        client = compoundpi.client.CompoundPiClient()
        client.record(5)
        l.assert_called_once_with('RECORD 5.0,h264,,,,0,', None)
Example #2
0
def test_client_record_now():
    with patch('compoundpi.client.CompoundPiServerList.transact') as l, \
            patch('compoundpi.client.CompoundPiDownloadServer'):
        l.return_value = {
            compoundpi.client.IPv4Address('192.168.0.1'): None,
            compoundpi.client.IPv4Address('192.168.0.2'): None,
            }
        client = compoundpi.client.CompoundPiClient()
        client.record(5)
        l.assert_called_once_with('RECORD 5.0,h264,,,,0,', None)
Example #3
0
def test_client_record_sync():
    with patch('compoundpi.client.CompoundPiServerList.transact') as l, \
            patch('compoundpi.client.time.time', return_value=1000.0), \
            patch('compoundpi.client.CompoundPiDownloadServer'):
        l.return_value = {
            compoundpi.client.IPv4Address('192.168.0.1'): None,
            compoundpi.client.IPv4Address('192.168.0.2'): None,
        }
        client = compoundpi.client.CompoundPiClient()
        client.record(5, format='mjpeg', delay=2)
        l.assert_called_once_with('RECORD 5.0,mjpeg,,,,0,1002.0', None)
Example #4
0
def test_client_record_sync():
    with patch('compoundpi.client.CompoundPiServerList.transact') as l, \
            patch('compoundpi.client.time.time', return_value=1000.0), \
            patch('compoundpi.client.CompoundPiDownloadServer'):
        l.return_value = {
            compoundpi.client.IPv4Address('192.168.0.1'): None,
            compoundpi.client.IPv4Address('192.168.0.2'): None,
            }
        client = compoundpi.client.CompoundPiClient()
        client.record(5, format='mjpeg', delay=2)
        l.assert_called_once_with('RECORD 5.0,mjpeg,,,,0,1002.0', None)