# Path: mqueue/tests/base.py
# class MqueueBaseTest(TestCase):
#     user: User
# 
#     def setUp(self):
#         self.factory = RequestFactory()
#         self.maxDiff = None
#         self.user = User.objects.create_user(  # type: ignore
#             "myuser", "myemail@test.com", "super_password"
#         )
# 
#     def reset(self):
#         for event in MEvent.objects.all():
#             event.delete()
# 
#     def create_mevent(
#         self,
#         name: str = "M event",
#         url: str = "/",
#         obj_pk: int = 1,
#         notes: str = "Notes",
#     ):
#         self._content_type = ContentType.objects.get_for_model(User)
#         return MEvent.objects.create(
#             name=name,
#             url=url,
#             obj_pk=obj_pk,
#             notes=notes,
#             model=User,
#             content_type=self._content_type,
#         )
# 
# Path: mqueue/models.py
# class MEvent(models.Model):
#     # required fields
#     content_type = models.ForeignKey(
#         ContentType,
#         null=True,
#         blank=True,
#         verbose_name=_("Content type"),
#         on_delete=SET_NULL,
#     )
#     obj_pk = models.IntegerField(
#         blank=True, null=True, verbose_name=_("Object primary key")
#     )
#     name = models.CharField(max_length=120, verbose_name=_("Name"))
#     # content fields
#     url = models.CharField(max_length=255, blank=True, verbose_name=_("Url"))
#     admin_url = models.CharField(
#         max_length=255, blank=True, verbose_name=_("Admin url")
#     )
#     notes = models.TextField(blank=True)
#     # meta
#     date_posted = models.DateTimeField(auto_now_add=True, verbose_name=_("Date posted"))
#     event_class = models.CharField(max_length=120, blank=True, verbose_name=_("Class"))
#     user = models.ForeignKey(
#         USER_MODEL,
#         null=True,
#         blank=True,
#         related_name="+",
#         on_delete=models.SET_NULL,
#         verbose_name=_("User"),
#     )
#     groups = models.ManyToManyField(
#         Group,
#         blank=True,
#         verbose_name=_("Groups"),
#     )
#     request = models.TextField(blank=True, verbose_name=_("Request"))
#     bucket = models.CharField(max_length=60, blank=True, verbose_name=_("Bucket"))
#     data = models.TextField(blank=True, verbose_name=_("Data"))
#     # manager
#     scope = models.CharField(
#         max_length=18,
#         choices=SCOPE,
#         default=SCOPE[0][0],
#         verbose_name=_("Scope"),
#     )
#     objects = MEventManager()
# 
#     class Meta:  # type: ignore
#         app_label = "mqueue"
#         verbose_name = _("Event")
#         verbose_name_plural = _("Events")
#         ordering = ["-date_posted"]
#         # permissions = (("view_mevent", "Can see Events"),)
# 
#     def __str__(self) -> str:
#         return f"{self.name} - {self.date_posted}"


from .base import MqueueBaseTest
from django.contrib.auth.models import User
from mqueue.models import MEvent


class MqueueTestManagers(MqueueBaseTest):
    def test_managers(self):
        self.reset()
        user = self.user
        mevent1 = MEvent.objects.create(name="event1", model=User)
        mevent2 = MEvent.objects.create(name="event2", instance=user)
        self.assertEqual(

# Path: mqueue/tests/base.py
# class MqueueBaseTest(TestCase):
#     user: User
# 
#     def setUp(self):
#         self.factory = RequestFactory()
#         self.maxDiff = None
#         self.user = User.objects.create_user(  # type: ignore
#             "myuser", "myemail@test.com", "super_password"
#         )
# 
#     def reset(self):
#         for event in MEvent.objects.all():
#             event.delete()
# 
#     def create_mevent(
#         self,
#         name: str = "M event",
#         url: str = "/",
#         obj_pk: int = 1,
#         notes: str = "Notes",
#     ):
#         self._content_type = ContentType.objects.get_for_model(User)
#         return MEvent.objects.create(
#             name=name,
#             url=url,
#             obj_pk=obj_pk,
#             notes=notes,
#             model=User,
#             content_type=self._content_type,
#         )
# 
# Path: mqueue/models.py
# class MEvent(models.Model):
#     # required fields
#     content_type = models.ForeignKey(
#         ContentType,
#         null=True,
#         blank=True,
#         verbose_name=_("Content type"),
#         on_delete=SET_NULL,
#     )
#     obj_pk = models.IntegerField(
#         blank=True, null=True, verbose_name=_("Object primary key")
#     )
#     name = models.CharField(max_length=120, verbose_name=_("Name"))
#     # content fields
#     url = models.CharField(max_length=255, blank=True, verbose_name=_("Url"))
#     admin_url = models.CharField(
#         max_length=255, blank=True, verbose_name=_("Admin url")
#     )
#     notes = models.TextField(blank=True)
#     # meta
#     date_posted = models.DateTimeField(auto_now_add=True, verbose_name=_("Date posted"))
#     event_class = models.CharField(max_length=120, blank=True, verbose_name=_("Class"))
#     user = models.ForeignKey(
#         USER_MODEL,
#         null=True,
#         blank=True,
#         related_name="+",
#         on_delete=models.SET_NULL,
#         verbose_name=_("User"),
#     )
#     groups = models.ManyToManyField(
#         Group,
#         blank=True,
#         verbose_name=_("Groups"),
#     )
#     request = models.TextField(blank=True, verbose_name=_("Request"))
#     bucket = models.CharField(max_length=60, blank=True, verbose_name=_("Bucket"))
#     data = models.TextField(blank=True, verbose_name=_("Data"))
#     # manager
#     scope = models.CharField(
#         max_length=18,
#         choices=SCOPE,
#         default=SCOPE[0][0],
#         verbose_name=_("Scope"),
#     )
#     objects = MEventManager()
# 
#     class Meta:  # type: ignore
#         app_label = "mqueue"
#         verbose_name = _("Event")
#         verbose_name_plural = _("Events")
#         ordering = ["-date_posted"]
#         # permissions = (("view_mevent", "Can see Events"),)
# 
#     def __str__(self) -> str:
#         return f"{self.name} - {self.date_posted}"


# Path: mqueue/tests/test_managers.py
from .base import MqueueBaseTest
from django.contrib.auth.models import User
from mqueue.models import MEvent



class MqueueTestManagers(MqueueBaseTest):
    def test_managers(self):
        self.reset()
        user = self.user
        mevent1 = MEvent.objects.create(name="event1", model=User)
        mevent2 = MEvent.objects.create(name="event2", instance=user)
        self.assertEqual(

            list(MEvent.objects.events_for_model(User)), [mevent2, mevent1]