(self)
| 5 | class Context_: |
| 6 | class sudo: |
| 7 | def base_case(self) -> None: |
| 8 | c = Context() |
| 9 | # Grab CI-oriented sudo user/pass direct from invocations.ci |
| 10 | # TODO: might be nice to give Collection a way to get a Config |
| 11 | # object direct, instead of a dict? |
| 12 | ci_conf = Config(ci_mod.ns.configuration()).ci.sudo |
| 13 | user = ci_conf.user |
| 14 | c.config.sudo.password = ci_conf.password |
| 15 | # Safety 1: ensure configured user even exists |
| 16 | assert c.run("id {}".format(user), warn=True) |
| 17 | # Safety 2: make sure we ARE them (and not eg root already) |
| 18 | assert c.run("whoami", hide=True).stdout.strip() == user |
| 19 | assert c.sudo("whoami", hide=True).stdout.strip() == "root" |
nothing calls this directly
no test coverage detected