from django.test import TestCase
from django.urls import reverse
from core.models import WardrobeItem, Accessory, Category

class HomeViewTest(TestCase):
    def setUp(self):
        self.category_w = Category.objects.create(name="T-Shirts", item_type='wardrobe')
        self.category_a = Category.objects.create(name="Rings", item_type='accessory')
        WardrobeItem.objects.create(name="Black Tee", category=self.category_w)
        Accessory.objects.create(name="Silver Ring", category=self.category_a)

    def test_home_view_status_code(self):
        response = self.client.get(reverse('home'))
        self.assertEqual(response.status_code, 200)

    def test_home_view_item_count(self):
        response = self.client.get(reverse('home'))
        self.assertContains(response, "2") # Total items: 1 wardrobe + 1 accessory