Ejemplo n.º 1
0
    def test_connect_reconnect_disconnect(self):
        sim = SimulatedUSB()
        # Connect ok
        self.assertTrue(sim.assign("Stroker785L"))
        self.assertTrue(sim.connect())

        # Re-connect raises typeerror
        self.assertRaises(TypeError, sim.connect)

        # disconnect ok
        self.assertTrue(sim.disconnect())

        # re-disconnect raises typeerror
        self.assertRaises(TypeError, sim.disconnect)
Ejemplo n.º 2
0
    def test_simulated_assign(self):
        sim = SimulatedUSB()

        # This is the break in functionality in the api. If you attempt
        # to connect to a simulation device before assigning a type, it
        # throws a valueerror exception.
        self.assertRaises(ValueError, sim.connect)
        self.assertRaises(ValueError, sim.disconnect)
       
        # Specify an invalid type, throw an error
        self.assertRaises(ValueError, sim.assign, "KnownInvalid")

        # Now that the type assignment has completed, connect will pass
        self.assertTrue(sim.assign("Stroker785L"))
        self.assertTrue(sim.connect())