Beispiel #1
0
 def test_fifo(self):
     mock = Mock()
     remote = QuodLibetUnixRemote(None, mock)
     remote._callback(b"foo\n")
     remote._callback(b"bar\nbaz")
     self.assertEqual(
         mock.lines, [bytes2fsn(b, None) for b in [b"foo", b"bar", b"baz"]])
Beispiel #2
0
 def test_response(self):
     with temp_filename() as fn:
         mock = Mock(resp=bytes2fsn(b"resp", None))
         remote = QuodLibetUnixRemote(None, mock)
         remote._callback(b"\x00foo\x00" + fsn2bytes(fn, None) + b"\x00")
         self.assertEqual(mock.lines, [bytes2fsn(b"foo", None)])
         with open(fn, "rb") as h:
             self.assertEqual(h.read(), b"resp")
Beispiel #3
0
 def test_response(self):
     with temp_filename() as fn:
         mock = Mock(resp=b"resp")
         remote = QuodLibetUnixRemote(None, mock)
         remote._callback(b"\x00foo\x00%s\x00" % fn)
         self.assertEqual(mock.lines, [b"foo"])
         with open(fn, "rb") as h:
             self.assertEqual(h.read(), b"resp")
Beispiel #4
0
 def test_response(self):
     with temp_filename() as fn:
         mock = Mock(resp=bytes2fsn(b"resp", None))
         remote = QuodLibetUnixRemote(None, mock)
         remote._callback(b"\x00foo\x00" + fsn2bytes(fn, None) + b"\x00")
         self.assertEqual(mock.lines, [bytes2fsn(b"foo", None)])
         with open(fn, "rb") as h:
             self.assertEqual(h.read(), b"resp")
Beispiel #5
0
 def test_response(self):
     with temp_filename() as fn:
         mock = Mock(resp=b"resp")
         remote = QuodLibetUnixRemote(None, mock)
         remote._callback(b"\x00foo\x00%s\x00" % fn)
         self.assertEqual(mock.lines, [b"foo"])
         with open(fn, "rb") as h:
             self.assertEqual(h.read(), b"resp")
Beispiel #6
0
 def test_fifo(self):
     mock = Mock()
     remote = QuodLibetUnixRemote(None, mock)
     remote._callback(b"foo\n")
     remote._callback(b"bar\nbaz")
     self.assertEqual(
         mock.lines, [bytes2fsn(b, None) for b in [b"foo", b"bar", b"baz"]])
Beispiel #7
0
 def run_receiver_and_remote():
     nonlocal remote
     remote = QuodLibetUnixRemote(None, self.registry)
     remote.start()
     GLib.idle_add(self._send_message_remote_proc, msg, proc_callback)