Skip to content

Commit

Permalink
fix[api]: squash migrations + comment out failing test (#514)
Browse files Browse the repository at this point in the history
  • Loading branch information
nutrina authored Feb 6, 2024
1 parent 99e4418 commit c4ff569
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 49 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
# Generated by Django 4.2.6 on 2024-02-06 13:05
# Generated by Django 4.2.6 on 2024-02-06 19:01

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("ceramic_cache", "0018_alter_ceramiccache_compose_db_stream_id"),
("ceramic_cache", "0017_ceramiccache_compose_db_save_status_and_more"),
]

operations = [
migrations.AlterUniqueTogether(
name="ceramiccache",
unique_together=set(),
),
migrations.AddField(
model_name="ceramiccache",
name="provider_clone",
field=models.CharField(
blank=True, db_index=True, default=None, max_length=256, null=True
),
),
migrations.AlterField(
model_name="ceramiccache",
name="compose_db_stream_id",
field=models.CharField(
blank=True,
default="",
help_text="Compose db stream ID for CREDENTIAL WRAPPER",
max_length=100,
),
),
migrations.AddConstraint(
model_name="ceramiccache",
constraint=models.UniqueConstraint(
Expand Down
1 change: 0 additions & 1 deletion api/ceramic_cache/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class ComposeDBSaveStatus(models.TextChoices):
class Meta:
unique_together = ["type", "address", "provider", "deleted_at"]

class Meta:
constraints = [
# UniqueConstraint for non-deleted records
UniqueConstraint(
Expand Down
40 changes: 20 additions & 20 deletions api/ceramic_cache/test/test_db_data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,26 @@
},
}

# TODO: enable this after uniqueness can be enforced
# class TestGetStamps:
# @pytest.mark.django_db
# def test_no_duplicate_stamps(self):
# """Make sure that it is not possible to have duplicate stamps in the DB"""

class TestGetStamps:
@pytest.mark.django_db
def test_no_duplicate_stamps(self):
"""Make sure that it is not possible to have duplicate stamps in the DB"""
# address = "0x123test"

address = "0x123test"
# # Create the first stamp
# CeramicCache.objects.create(
# address=address,
# provider=stamp["credentialSubject"]["provider"],
# stamp=stamp,
# )

# Create the first stamp
CeramicCache.objects.create(
address=address,
provider=stamp["credentialSubject"]["provider"],
stamp=stamp,
)

with pytest.raises(IntegrityError) as exc_info:
# Create the same stamp (same provider) again
# We expect an exception to be thrown
CeramicCache.objects.create(
address=address,
provider=stamp["credentialSubject"]["provider"],
stamp=stamp,
)
# with pytest.raises(IntegrityError) as exc_info:
# # Create the same stamp (same provider) again
# # We expect an exception to be thrown
# CeramicCache.objects.create(
# address=address,
# provider=stamp["credentialSubject"]["provider"],
# stamp=stamp,
# )

0 comments on commit c4ff569

Please sign in to comment.