-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing fields for App Store Connect models #383
Conversation
…finitions/add-missing-fields-for-models
@pytest.fixture() | ||
def app_store_connect(namespace_kwargs) -> AppStoreConnect: | ||
args = AppStoreConnectArgument | ||
if "TEST_APPLE_PRIVATE_KEY_PATH" in os.environ: | ||
key_path = pathlib.Path(os.environ["TEST_APPLE_PRIVATE_KEY_PATH"]) | ||
private_key = key_path.expanduser().read_text() | ||
key_identifier = os.environ["TEST_APPLE_KEY_IDENTIFIER"] | ||
issuer_id = os.environ["TEST_APPLE_ISSUER_ID"] | ||
elif "TEST_APPLE_PRIVATE_KEY_CONTENT" in os.environ: | ||
private_key = os.environ["TEST_APPLE_PRIVATE_KEY_CONTENT"] | ||
key_identifier = os.environ["TEST_APPLE_KEY_IDENTIFIER"] | ||
issuer_id = os.environ["TEST_APPLE_ISSUER_ID"] | ||
else: | ||
raise RuntimeError("Missing App Store Connect authentication information") | ||
|
||
ns = namespace_kwargs | { | ||
args.ISSUER_ID.key: Types.IssuerIdArgument(issuer_id), | ||
args.KEY_IDENTIFIER.key: Types.KeyIdentifierArgument(key_identifier), | ||
args.PRIVATE_KEY.key: Types.PrivateKeyArgument(private_key), | ||
} | ||
cli_args = argparse.Namespace(**ns) | ||
return AppStoreConnect.from_cli_args(cli_args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixture doesn't seem to be used anywhere in the codebase, can you elaborate what purpose it serves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are quite right that as of now it is not used anywhere. But it is very useful for quickly testing out actual command invocations using tests instead of doing it from terminal with
python -m codemagic.toos.app_store_connect <action> <args> ...
I could add an example test which uses this fixture, but is skipped unless live API tests are enabled. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think let's add an example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 64ae629.
…finitions/add-missing-fields-for-models
def test_get_app(app_store_connect: AppStoreConnect): | ||
app = app_store_connect.get_app(ResourceId("1481211155")) | ||
assert isinstance(app, App) | ||
assert app.id == "1481211155" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Whenever App Store Connect API responses are converted to
codemagic.apple.resources.App
orcodemagic.apple.resources.Build
instances, then the logs get flooded with warning about unknown fields for attributes and relationships.App warnings
Build warnings
Changes here add definitions for those fields.