Skip to content

Commit

Permalink
Add export test
Browse files Browse the repository at this point in the history
fixes: pulp#1325
  • Loading branch information
rochacbruno committed Feb 23, 2023
1 parent eda138b commit 8b4e22f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
14 changes: 14 additions & 0 deletions pulp_ansible/app/migrations/0048_merge_20230223_1246.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 3.2.18 on 2023-02-23 12:46

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('ansible', '0047_ansible_namespace'),
('ansible', '0047_collectionversionmark'),
]

operations = [
]
4 changes: 2 additions & 2 deletions pulp_ansible/app/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class CollectionVersionSignatureViewSet(NoArtifactContentUploadViewSet):
serializer_class = CollectionVersionSignatureSerializer


class MarkFilter(ContentFilter):
class CollectionVersionMarkFilter(ContentFilter):
"""
A filter for marks.
"""
Expand All @@ -259,7 +259,7 @@ class CollectionVersionMarkViewSet(ContentViewSet):
"""

endpoint_name = "collection_marks"
filterset_class = MarkFilter
filterset_class = CollectionVersionMarkFilter
queryset = CollectionVersionMark.objects.all()
serializer_class = CollectionVersionMarkSerializer

Expand Down
11 changes: 11 additions & 0 deletions pulp_ansible/tests/functional/api/test_export_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ def test_export_then_import(
repo_ver_a = ansible_repo_version_api_client.read(f"{repo_a.pulp_href}versions/2/")
repo_ver_b = ansible_repo_version_api_client.read(f"{repo_b.pulp_href}versions/1/")

mark_body = {
"content_units": ["*"],
"value": "exportable-mark",
}
monitor_task(ansible_repo_api_client.mark(repo_a.pulp_href, mark_body).task)
repo_ver_a = ansible_repo_version_api_client.read(f"{repo_a.pulp_href}versions/3/")

# Prepare export
exporter = gen_object_with_cleanup(
exporters_pulp_api_client,
Expand Down Expand Up @@ -107,6 +114,10 @@ def test_export_then_import(
repo_ver_c.content_summary.added["ansible.collection_signature"]["count"]
== repo_ver_a.content_summary.present["ansible.collection_signature"]["count"]
)
assert (
repo_ver_c.content_summary.added["ansible.collection_mark"]["count"]
== repo_ver_a.content_summary.present["ansible.collection_mark"]["count"]
)
assert (
repo_ver_d.content_summary.added["ansible.role"]["count"]
== repo_ver_b.content_summary.present["ansible.role"]["count"]
Expand Down

0 comments on commit 8b4e22f

Please sign in to comment.