Example #1
0
 def sudo_also_covered(self):
     c = MockContext(sudo=Result(stderr="super duper"))
     assert c.sudo("doesn't mattress").stderr == "super duper"
     try:
         MockContext().sudo("meh")
     except NotImplementedError:
         pass
     else:
         assert False, "Did not get a NotImplementedError for sudo!"
Example #2
0
 def sudo(self):
     mc = MockContext(sudo={"foo": Result("bar")})
     assert mc.sudo("foo").stdout == "bar"
     mc.set_result_for("sudo", "foo", Result("biz"))
     assert mc.sudo("foo").stdout == "biz"