-
Notifications
You must be signed in to change notification settings - Fork 0
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
Check create method + db unit test #6
Merged
Merged
Changes from 7 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
06ab246
ResourceProviderAccount
38e5725
add consumer_uuid + user_ref
4e4ae36
black
7bc0b86
create method
384202d
add to request
7fc3aa5
check_create method
242e23b
ConsumerRequest method adapted for blazar requests
23625a9
todo select_for_update
2449be5
black
758eea8
move to ConsumerViewSet
fe911f7
handle update case
2687b5b
arbitrary length resource request
c7eda83
ResourceProviderAccount
16b10ad
add consumer_uuid + user_ref
b2773b4
black
05b7591
Add helm chart with initial functional test (#2)
scrungus 1417ac9
black
5dfadcf
move to ConsumerViewSet
16ed741
add dry run methods
ba767b3
look for 'total' in resource request
db201a1
todo
4f7ac49
allow empty
0bef819
black
db4e6fd
unittest-style tests
ce4d9b9
test settings
1eb6b69
use pytest
25fc0ed
consumer route
0ae13c7
formatting
cd4f5b8
fixes
2639563
init test file
ebf8d37
add unit test
47703e5
black
4be7fe2
Merge branch 'add-resourceprovideraccount-table' into check-create-me…
fc82077
black
56e3e0f
request object classes
2eddd7e
exceptions
b50b40d
refactor
f8944e3
black
528fdf3
separate unit tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
coral_credits/api/migrations/0004_resourceprovideraccount_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Generated by Django 5.0.6 on 2024-07-04 15:54 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("api", "0003_rename_consume_ref_consumer_consumer_ref_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="ResourceProviderAccount", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("project_id", models.UUIDField()), | ||
( | ||
"account", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="api.creditaccount", | ||
), | ||
), | ||
( | ||
"provider", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="api.resourceprovider", | ||
), | ||
), | ||
], | ||
options={ | ||
"unique_together": { | ||
("account", "provider"), | ||
("provider", "project_id"), | ||
}, | ||
}, | ||
), | ||
migrations.AlterUniqueTogether( | ||
name="consumer", | ||
unique_together=set(), | ||
), | ||
migrations.AddField( | ||
model_name="consumer", | ||
name="resource_provider_account", | ||
field=models.ForeignKey( | ||
default=1, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
to="api.resourceprovideraccount", | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.AlterUniqueTogether( | ||
name="consumer", | ||
unique_together={("consumer_ref", "resource_provider_account")}, | ||
), | ||
migrations.RemoveField( | ||
model_name="consumer", | ||
name="account", | ||
), | ||
migrations.RemoveField( | ||
model_name="consumer", | ||
name="resource_provider", | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
coral_credits/api/migrations/0005_consumer_consumer_uuid_consumer_user_ref.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 5.0.6 on 2024-07-04 16:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("api", "0004_resourceprovideraccount_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="consumer", | ||
name="consumer_uuid", | ||
field=models.UUIDField(default=""), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name="consumer", | ||
name="user_ref", | ||
field=models.UUIDField(default=""), | ||
preserve_default=False, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 we should be able to have the same request format standardised across all resource providers?
@assumptionsandg I've added some TODOs on what additions we need to the request that blazar sends to the coral-credits API, perhaps @JohnGarbutt has some suggestions on this