def test_write_cred_already_exists(): with fake_creds(): creds = { "WEBAPP_URL": "https://staging.jovian.ai/", "GUEST_KEY": "b6538d4dfde04fcf993463a828a9cec6", "ORG_ID": "staging", "API_URL": "https://api-staging.jovian.ai" } write_creds(creds) write_cred('ORG_ID', 'staging') expected_result = creds assert read_creds() == expected_result
def test_write_cred(): with fake_creds(): creds = { "WEBAPP_URL": "https://staging.jovian.ai/", "GUEST_KEY": "b6538d4dfde04fcf993463a828a9cec6", "ORG_ID": "staging", "API_URL": "https://api-staging.jovian.ai" } write_creds(creds) write_cred('FAKE_KEY', 'fake_value') expected_result = { "WEBAPP_URL": "https://staging.jovian.ai/", "GUEST_KEY": "b6538d4dfde04fcf993463a828a9cec6", "ORG_ID": "staging", "API_URL": "https://api-staging.jovian.ai", "FAKE_KEY": "fake_value" } assert read_creds() == expected_result