Skip to content

Commit 1b2397e

Browse files
Fixed payload between CoreRepositoryCreate and CoreReadOnlyRepositoryCreate mutations.
1 parent 9826af2 commit 1b2397e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

infrahub_sdk/ctl/repository.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,12 @@ async def add(
8585
"name": {"value": name},
8686
"location": {"value": location},
8787
"description": {"value": description},
88-
"ref": {"value": ref},
8988
},
9089
}
90+
if read_only:
91+
input_data["data"]["ref"] = {"value": ref}
92+
else:
93+
input_data["data"]["default_branch"] = {"value": ref}
9194

9295
client = initialize_client()
9396

tests/unit/ctl/test_repository_app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_repo_no_username_or_password(self, mock_init_client, mock_client) -> No
6363
description: {
6464
value: ""
6565
}
66-
ref: {
66+
default_branch: {
6767
value: ""
6868
}
6969
}
@@ -120,7 +120,7 @@ def test_repo_no_username(self, mock_init_client, mock_client) -> None:
120120
description: {
121121
value: ""
122122
}
123-
ref: {
123+
default_branch: {
124124
value: ""
125125
}
126126
credential: {
@@ -182,7 +182,7 @@ def test_repo_username(self, mock_init_client, mock_client) -> None:
182182
description: {
183183
value: ""
184184
}
185-
ref: {
185+
default_branch: {
186186
value: ""
187187
}
188188
credential: {
@@ -311,7 +311,7 @@ def test_repo_description_commit_branch(self, mock_init_client, mock_client) ->
311311
description: {
312312
value: "This is a test description"
313313
}
314-
ref: {
314+
default_branch: {
315315
value: "my-custom-branch"
316316
}
317317
credential: {

0 commit comments

Comments
 (0)