This repository has been archived by the owner on Feb 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Jaroslav Sevcik
committed
Jul 13, 2021
1 parent
2070434
commit 15e7d1a
Showing
38 changed files
with
1,317 additions
and
858 deletions.
There are no files selected for viewing
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
Empty file.
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,73 @@ | ||
import pytest | ||
import yaml | ||
|
||
from zoo.repos.entities_yaml import generate, validate | ||
from zoo.repos.models import Repository | ||
from zoo.services.models import Environment, Service | ||
|
||
pytestmark = pytest.mark.django_db | ||
|
||
|
||
@pytest.fixture | ||
def generate_base_component(component_base_factory, link_factory, group_factory): | ||
group = group_factory(id=1, product_owner="john", project_owner="doe") | ||
group.save() | ||
component = component_base_factory( | ||
id=1, | ||
name="base", | ||
type="database", | ||
description="This is my fancy component", | ||
kind="component", | ||
owner="platform", | ||
service=None, | ||
library=None, | ||
source__id=1, | ||
source__remote_id=1, | ||
source__owner="jasckson", | ||
source__name="thiwer", | ||
source__url="https://gitlab.com/thiwer/thiwer", | ||
group=group, | ||
) | ||
component.save() | ||
link_factory( | ||
id=1, | ||
name="Datadog", | ||
url="https://dashboard.datadog.com", | ||
icon="poop", | ||
entity=component, | ||
) | ||
link_factory( | ||
id=2, | ||
name="Sentry", | ||
url="https://sentry.skypicker.com", | ||
entity=component, | ||
) | ||
|
||
|
||
def test_generate_base_component(generate_base_component): | ||
expected = """ | ||
- apiVersion: v1alpha1 | ||
kind_: component | ||
metadata: | ||
name: base | ||
owner: platform | ||
group: | ||
product_owner: john | ||
project_owner: doe | ||
maintainers: [] | ||
description: This is my fancy component | ||
tags: [] | ||
links: | ||
- name: Datadog | ||
url: https://dashboard.datadog.com | ||
icon: poop | ||
- name: Sentry | ||
url: https://sentry.skypicker.com | ||
icon: null | ||
spec: | ||
type_: database | ||
""" | ||
repository = Repository.objects.get(pk=1) | ||
content = generate(repository) | ||
assert validate(content) | ||
assert expected.strip() == content.strip() |
Oops, something went wrong.