Ejemplo n.º 1
0
 def test3_1_pin(self):
     """
     Pin >3_1> read_real_life()
     """
     test1_file = "%s/packaged/etc/raspigpioctrl/pin1.cfg" % PREFIX
     pin1 = SlavePin(self.opt, test1_file)
     self.assertTrue("0" == pin1.read_real_life())
     pin1.flip()
     self.assertTrue("1" == pin1.read_real_life())
Ejemplo n.º 2
0
    def test0_1_init_flip(self):
        """
        Web >0_1> show green status
        """

        test1_file = "%s/packaged/etc/raspigpioctrl/pin1.cfg" % PREFIX
        pin1 = SlavePin(self.opt, test1_file)
        pin1.init_pin(True)
        pin1.flip()

        web = Web(self.opt)
        web.add_pin(pin1)
        web.index()
        exp = [line for line in self.exp_head]
        exp.extend([line for line in self.exp_pin1])
        exp.extend([line for line in self.exp_tail])
        exp[20] = "<td style='background-color:green'>"
        self.assertEqual(web.html, exp)
Ejemplo n.º 3
0
 def test3_3_flip(self):
     """
     Pin >3_3> init dry-run pin and flip twice
     """
     test1_file = "%s/packaged/etc/raspigpioctrl/pin1.cfg" % PREFIX
     pin1 = SlavePin(self.opt, test1_file)
     gpio_sys = "%s/packaged/sys/class/gpio/" % PREFIX
     if os.path.exists("%s/packaged/sys" % PREFIX):
         print os.system("rm -rf %s/packaged/sys" % PREFIX)
         pin1.deb("'%s' removed")
         self.assertFalse(os.path.exists(gpio_sys), "")
     pin1.init_pin()
     pin1.flip()
     filed = open("%s/gpio1/value" % gpio_sys, "r")
     cont = filed.read().strip()
     filed.close()
     self.assertTrue(cont == "1", cont)
     pin1.flip()
     filed = open("%s/gpio1/value" % gpio_sys, "r")
     cont = filed.read().strip()
     filed.close()
     self.assertTrue(cont == "0", cont)