Skip to content

Commit

Permalink
feat: add model: check_type
Browse files Browse the repository at this point in the history
  • Loading branch information
dmartin4820 authored and fyliu committed Aug 26, 2024
1 parent 9e93761 commit 3b386f7
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
42 changes: 42 additions & 0 deletions app/core/migrations/0024_checktype.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Generated by Django 4.2.11 on 2024-08-21 01:34

from django.db import migrations, models
import uuid


class Migration(migrations.Migration):

dependencies = [
("core", "0023_event_could_attend_event_must_attend_and_more"),
]

operations = [
migrations.CreateModel(
name="CheckType",
fields=[
(
"uuid",
models.UUIDField(
default=uuid.uuid4,
editable=False,
primary_key=True,
serialize=False,
unique=True,
),
),
(
"created_at",
models.DateTimeField(auto_now_add=True, verbose_name="Created at"),
),
(
"updated_at",
models.DateTimeField(auto_now=True, verbose_name="Updated at"),
),
("name", models.CharField(max_length=255)),
("description", models.TextField(blank=True)),
],
options={
"abstract": False,
},
),
]
2 changes: 1 addition & 1 deletion app/core/migrations/max_migration.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0023_event_could_attend_event_must_attend_and_more
0024_checktype
12 changes: 12 additions & 0 deletions app/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,15 @@ def __str__(self):
return f"Partner {self.affiliate}"
else:
return "Neither a partner or a sponsor"


class CheckType(AbstractBaseModel):
"""
Types of checks we perform
"""

name = models.CharField(max_length=255)
description = models.TextField(blank=True)

def __str__(self):
return f"{self.name}"
9 changes: 9 additions & 0 deletions app/core/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from ..models import Affiliate
from ..models import Affiliation
from ..models import CheckType
from ..models import Event
from ..models import Faq
from ..models import FaqViewed
Expand Down Expand Up @@ -196,3 +197,11 @@ def affiliation4(project, affiliate):
return Affiliation.objects.create(
is_sponsor=False, is_partner=False, project=project, affiliate=affiliate
)


@pytest.fixture
def check_type():
return CheckType.objects.create(
name="This is a test check_type.",
description="This is a test check_type description.",
)
5 changes: 5 additions & 0 deletions app/core/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,8 @@ def test_affiliation_is_neither_partner_and_sponsor(affiliation4):
assert xref_instance.is_sponsor is False
assert xref_instance.is_partner is False
assert str(xref_instance) == "Neither a partner or a sponsor"


def test_check_type(check_type):
assert str(check_type) == "This is a test check_type."
assert check_type.description == "This is a test check_type description."

0 comments on commit 3b386f7

Please sign in to comment.