-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58b88e9
commit 832a235
Showing
9 changed files
with
387 additions
and
47 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
dice_deploy_django/cfy_wrapper/migrations/0002_container.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,27 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.9.4 on 2016-03-10 09:41 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import uuid | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('cfy_wrapper', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Container', | ||
fields=[ | ||
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), | ||
('blueprint', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='cfy_wrapper.Blueprint')), | ||
], | ||
options={ | ||
'abstract': 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
from rest_framework import serializers | ||
|
||
from .models import Blueprint | ||
from .models import Blueprint, Container | ||
|
||
|
||
class BlueprintSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Blueprint | ||
fields = ("state_name", "cfy_id") | ||
|
||
|
||
class ContainerSerializer(serializers.ModelSerializer): | ||
blueprint = BlueprintSerializer() | ||
|
||
class Meta: | ||
model = Container | ||
fields = ("id", "blueprint") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ cloudify_rest_client | |
celery | ||
enum34 | ||
flower | ||
django-factory-boy |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import factory | ||
from cfy_wrapper.models import Container, Blueprint | ||
from django.conf import settings | ||
|
||
|
||
class BlueprintPendingFactory(factory.DjangoModelFactory): | ||
state = Blueprint.State.pending.value | ||
archive = factory.django.FileField(from_path=settings.TEST_FILE_BLUEPRINT_EXAMPLE) | ||
|
||
class Meta: | ||
model = Blueprint | ||
|
||
|
||
class BlueprintDeployedFactory(factory.DjangoModelFactory): | ||
state = Blueprint.State.deployed.value | ||
archive = factory.django.FileField(from_path=settings.TEST_FILE_BLUEPRINT_EXAMPLE) | ||
|
||
class Meta: | ||
model = Blueprint | ||
|
||
|
||
class ContainerEmptyFactory(factory.DjangoModelFactory): | ||
class Meta: | ||
model = Container | ||
|
||
|
||
class ContainerFullFactory(factory.DjangoModelFactory): | ||
blueprint = factory.SubFactory(BlueprintDeployedFactory) | ||
|
||
class Meta: | ||
model = Container | ||
|
||
|
||
|
Oops, something went wrong.