-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start building testing suite for new features
- Loading branch information
1 parent
89e5fae
commit 354742d
Showing
27 changed files
with
152 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.db import models | ||
|
||
|
||
class AnimalQuerySet(models.QuerySet): | ||
def get_available_animals(self): | ||
return self.filter(status="AVAILABLE") | ||
|
||
def get_animals_needing_medical_attention(self): | ||
""" | ||
Return a QuerySet of Animal objects that need medical attention, | ||
i.e. where the status is "MEDICAL_HOLD". | ||
""" | ||
|
||
return self.filter(status="MEDICAL_HOLD" / "QUARANTINE") |
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,31 @@ | ||
import factory | ||
|
||
from dragonroost.animals.models import Species | ||
from dragonroost.business.tests.factories import LocationFactory | ||
|
||
|
||
class SpeciesFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = "animals.Species" | ||
django_get_or_create = ("name", "class_name", "diet", "is_ohio_native") | ||
|
||
name = factory.Sequence(lambda n: f"Species {n}") | ||
class_name = factory.Faker( | ||
"random_element", | ||
elements=[x[0] for x in Species.CLASS_CHOICES], | ||
) | ||
diet = factory.Faker( | ||
"random_element", | ||
elements=[x[0] for x in Species.DIET_CHOICES], | ||
) | ||
is_ohio_native = factory.Iterator([True, False]) | ||
|
||
|
||
class AnimalFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = "animals.Animal" | ||
django_get_or_create = ("name", "breed", "species") | ||
|
||
name = factory.Faker("first_name") | ||
species = factory.SubFactory(SpeciesFactory) | ||
location = factory.SubFactory(LocationFactory) |
Empty file.
Empty file.
Empty file.
38 changes: 38 additions & 0 deletions
38
dragonroost/business/migrations/0002_transactioncategory_transaction_delete_donation.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,38 @@ | ||
# Generated by Django 5.0.9 on 2024-11-27 13:42 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('business', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='TransactionCategory', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=50, unique=True)), | ||
], | ||
options={ | ||
'verbose_name_plural': 'Categories', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='Transaction', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('amount', models.DecimalField(decimal_places=2, default=0.0, max_digits=10)), | ||
('type', models.CharField(choices=[('INCOME', 'Income'), ('EXPENSE', 'Expense')], max_length=10)), | ||
('description', models.TextField(blank=True, default='')), | ||
('date', models.DateTimeField(auto_now_add=True)), | ||
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='business.transactioncategory')), | ||
], | ||
), | ||
migrations.DeleteModel( | ||
name='Donation', | ||
), | ||
] |
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 was deleted.
Oops, something went wrong.
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,22 @@ | ||
import factory | ||
|
||
from dragonroost.business.models import Location | ||
from dragonroost.business.models import Meeting | ||
|
||
|
||
class LocationFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = Location | ||
django_get_or_create = ("name",) | ||
|
||
name = factory.Sequence(lambda n: f"Location {n}") | ||
description = factory.Sequence(lambda n: f"Description {n}") | ||
|
||
|
||
class MeetingFactory(factory.django.DjangoModelFactory): | ||
class Meta: | ||
model = Meeting | ||
django_get_or_create = ("title",) | ||
|
||
title = factory.Sequence(lambda n: f"Meeting {n}") | ||
description = factory.Sequence(lambda n: f"Description {n}") |
Empty file.
Empty file.
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
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.