def test_comm_read_write(self):
     ex.comm_write(EXP, "RR 12342")
     comm = open(EXP + COMM_FILE, 'r')
     msg = comm.read()
     comm.close()
     self.assertEqual(msg, "RR 12342", "write explorer stream fail")
     comm = open(EXP + COMM_FILE, 'w')
     comm.write("WS 23123")
     comm.close()
     self.assertEqual(ex.comm_read(EXP), "WS 23123",
                      "read explorer stream fail")
     self.tearDown()
 def test_stop(self):
     ex.comm_write(EXP, "RR 12332")
     self.assertEqual(format('Stop: %s - Stopping' % ex.name_format(EXP)),
                      ex.stop(EXP),
                      "use stop function in wait should show msg and "
                      + "change status")
     self.assertEqual(ex.get_status(EXP), "W",
                      "when stop in run should change status to wait")
     ex.comm_write(EXP, "WR 23123")
     self.assertEqual(format('%s - Last Command Not Processed Yet' %
                             ex.name_format(EXP)), ex.stop(EXP),
                      "use stop function in wait should show msg and "
                      + "no other change")
     ex.comm_write(EXP, "PR 33241")
     self.assertEqual(format('Stop: %s - Stopping Paused Explorer' %
                             ex.name_format(EXP)), ex.stop(EXP),
                      "use stop function in pause should show msg and "
                      + "change status")
     self.assertEqual(ex.get_status(EXP), "W",
                      "when stop in pause should change status to wait")
     ex.comm_write(EXP, "SR 23123")
     self.assertEqual(format('Stop: %s - Cannot Stop non-Started Explorer' %
                             ex.name_format(EXP)), ex.stop(EXP),
                      "use stop function in stop should show msg and "
                      + "no other change")
     self.tearDown()
 def test_pause(self):
     ex.comm_write(EXP, "RP 12323")
     self.assertEqual(format('Pause: %s - Pausing' % ex.name_format(EXP)),
                      ex.pause(EXP),
                      "use pause function in run should show msg and change"
                      + " status to wait")
     self.assertEqual(ex.get_status(EXP), "W",
                      "status should change to wait when on run")
     ex.comm_write(EXP, "WR 23332")
     self.assertEqual(format('%s - Last Command Not Processed Yet' %
                             ex.name_format(EXP)), ex.pause(EXP),
                      "use pause function in wait should show msg and "
                      + "no other change")
     ex.comm_write(EXP, "PP 12342")
     self.assertEqual(format('Pause: %s - Already in Pause' %
                             ex.name_format(EXP)), ex.pause(EXP),
                      "use pause function in pause should show msg and "
                      + "no other change")
     ex.comm_write(EXP, "SR 23122")
     self.assertEqual(format('Pause: %s - Cannot pause non-Started Instance'
                             % ex.name_format(EXP)), ex.pause(EXP),
                      "use pause function in wait should show msg and "
                      + "no other change")
     self.tearDown()
 def test_run(self):
     ex.comm_write(EXP, "RR 22321")
     self.assertEqual(format('Run: %s - Already Running' %
                             ex.name_format(EXP)), ex.run(EXP),
                      "use run function in run should show msg "
                      + "and no other change")
     ex.comm_write(EXP, "WR 23412")
     self.assertEqual(format('%s - Last Command Not Processed Yet' %
                             ex.name_format(EXP)), ex.run(EXP),
                      "use run function in wait should show msg and no "
                      + "other change")
     ex.comm_write(EXP, "PR 32412")
     self.assertEqual(format('Run: %s - Resuming' % ex.name_format(EXP)),
                      ex.run(EXP),
                      "use run function in pause should show msg and "
                      + "change status to wait")
     self.assertEqual(ex.get_status(EXP), "W",
                      "status chould change to wait when is paused")
     ex.comm_write(EXP, "SR 12345")
     self.assertEqual(format('Run: %s - Started Running' %
                             ex.name_format(EXP)), ex.run(EXP),
                      "use run function in stop should show msg and no "
                      + "other change")
     self.tearDown()
 def test_get_status(self):
     ex.comm_write(EXP, "WS 12323")
     self.assertEqual(ex.get_status(EXP), "W",
                      "get status should get the first of the stream file")
     self.tearDown()