def AllAccounts(options, dothree=False): try: log.info(f"install-template.py {__version__}") log.info("installing / updating to all accounts") ch = Chaim("wibble", "wobble") accts = ch.requestList() del ch cn = 0 for acct in accts: cn += 1 if cn > 2 and dothree: break if acct[0] == "324919260230": log.info("Checking billing account") options["profile"] = "awsbilling" options["acctname"] = "Connected Homes" installstack(options) else: options["profile"] = "tempname" with Chaim(acct[1], "apu", 1) as success: if success: options["acctname"] = acct[1] # makePackage("tempname", acct[0]) # stackstatus(stackname, profile="tempname") installstack(options) else: msg = f"failed to obtain creds for account {acct[1]}" raise Exception(msg) # break except Exception as e: fname = sys._getframe().f_code.co_name errorExit(fname, e)
def test_myAccountList(): ch = Chaim("sredev", "rro") lst = ch.myAccountList() now = int(time.time()) if len(lst) > 1: ts = int(lst[0][1]) assert ts > now else: assert False == True
def test_allAccountList(): ch = Chaim("sredev", "rro") lst = ch.requestList() found = False for acct in lst: if acct[0] == "324919260230" and acct[1] == "Connected Homes": found = True break assert found == True
def test_parking(): ch = Chaim("sredev", "rro", verbose=0) ch.unparkAccount("hprod") lst = ch.listParkAccounts() found = findInList("hprod", lst) if not found: ch.parkAccount("hprod") lst = ch.listParkAccounts() found = findInList("hprod", lst) assert found == True else: assert found == False
def main(): sg.theme("LightGreen") # Add a touch of color ch = Chaim("wibble", "wobble") while True: event = statusDisplay(ch) if event in ("New"): newAccount(ch) elif event not in (None, "Quit"): print("status again") elif event in (None, "Quit"): break
def test_listParked(): ch = Chaim("sredev", "rro") lst = ch.listParkAccounts() found = findInList("hprod", lst) assert found == True
def test_chaim_ctx_fail(): with Chaim("Connected Homes", "rro", verbose=0) as success: assert success == False
def test_chaim_contextmanager(): with Chaim("sredev", "rro", verbose=0) as success: assert success == True