Lines Matching refs:self
31 def exists_validvals(self, varname, varlist, validlist): argument
32 self.assertIn(varname, varlist)
33 self.assertIn(varlist[varname], validlist)
36 def exists_yes_no(self, varname, varlist): argument
37 return self.exists_validvals(varname, varlist, ["yes", "no"])
39 def exists_nonempty(self, varname, varlist): argument
40 self.assertIn(varname, varlist)
41 self.assertGreater(len(varlist[varname]), 0)
44 def exists_integer(self, varname, varlist, base=10): argument
46 self.assertIn(varname, varlist)
50 self.fail("%s (%s) is not an integer" % (varname, varlist[varname]))
53 def get_exists(self, varname): argument
54 val = self.fastboot.getvar(varname)
55 self.assertIsNotNone(val)
58 def get_exists_validvals(self, varname, validlist): argument
59 val = self.get_exists(varname)
60 self.assertIn(val, validlist)
63 def get_exists_yes_no(self, varname): argument
64 return self.get_exists_validvals(varname, ["yes", "no"])
66 def get_exists_nonempty(self, varname): argument
67 val = self.get_exists(varname)
68 self.assertGreater(len(val), 0)
71 def get_exists_integer(self, varname, base=10): argument
72 val = self.get_exists(varname)
76 self.fail("%s (%s) is not an integer" % (varname, val))
79 def get_slotcount(self): argument
82 val = self.fastboot.getvar("slot-count")
86 self.fail("slot-count (%s) is not an integer" % val)
93 def test_getvarall(self): argument
96 var_all = self.fastboot.getvar_all()
97 self.exists_nonempty("version-baseband", var_all)
98 self.exists_nonempty("version-bootloader", var_all)
99 self.exists_nonempty("product", var_all)
100 self.exists_yes_no("secure", var_all)
101 self.exists_yes_no("unlocked", var_all)
102 self.exists_validvals("off-mode-charge", var_all, ["0", "1"])
103 self.assertIn("variant", var_all)
104 voltage = self.exists_nonempty("battery-voltage", var_all)
110 self.fail("battery-voltage (%s) is not a number" % (varname, voltage))
111 self.exists_yes_no("battery-soc-ok", var_all)
112 maxdl = self.exists_integer("max-download-size", var_all, 16)
113 self.assertGreater(maxdl, 0)
119 self.fail("slot-count (%s) is not an integer" % var_all["slot-count"])
123 self.exists_validvals("current-slot", var_all, slots)
127 self.exists_yes_no("slot-unbootable:"+slot, var_all)
128 self.exists_yes_no("slot-unbootable:"+slot, var_all)
129 self.exists_integer("slot-retry-count:"+slot, var_all)
133 def test_getvar_nonexistent(self): argument
136 self.assertIsNone(self.fastboot.getvar("fhqwhgads"))
138 def test_getvar(self): argument
141 self.get_exists_nonempty("version-baseband")
142 self.get_exists_nonempty("version-bootloader")
143 self.get_exists_nonempty("product")
144 self.get_exists_yes_no("secure")
145 self.get_exists_yes_no("unlocked")
146 self.get_exists_validvals("off-mode-charge", ["0", "1"])
147 self.get_exists("variant")
148 voltage = self.get_exists_nonempty("battery-voltage")
154 self.fail("battery-voltage (%s) is not a number" % voltage)
155 self.get_exists_yes_no("battery-soc-ok")
156 maxdl = self.get_exists_integer("max-download-size", 16)
157 self.assertGreater(maxdl, 0)
159 slotcount = self.get_slotcount()
163 self.get_exists_validvals("current-slot", slots)
167 self.get_exists_yes_no("slot-unbootable:"+slot)
168 self.get_exists_yes_no("slot-successful:"+slot)
169 self.get_exists_integer("slot-retry-count:"+slot)
171 def test_setactive(self): argument
174 slotcount = self.get_slotcount()
181 self.fastboot.set_active(slot)
182 self.assertEqual(slot, self.fastboot.getvar("current-slot"))
183 self.assertEqual("no", self.fastboot.getvar("slot-unbootable:"+slot))
184 self.assertEqual("no", self.fastboot.getvar("slot-successful:"+slot))
185 retry = self.get_exists_integer("slot-retry-count:"+slot)
189 self.assertEqual(maxtries, retry)
190 self.fastboot.reboot(True)
191 self.assertEqual(slot, self.fastboot.getvar("current-slot"))
192 self.assertEqual("no", self.fastboot.getvar("slot-unbootable:"+slot))
193 self.assertEqual("no", self.fastboot.getvar("slot-successful:"+slot))
194 retry = self.get_exists_integer("slot-retry-count:"+slot)
198 self.assertEqual(maxtries, retry)
200 def test_hasslot(self): argument
203 if not self.get_slotcount():
206 self.assertEqual("yes", self.fastboot.getvar("has-slot:system"))
207 self.assertEqual("yes", self.fastboot.getvar("has-slot:boot"))
211 self.assertEqual("yes", self.fastboot.getvar("has-slot:oem"))