How to use the mixer.backend.django.mixer.RANDOM function in mixer

To help you get started, we’ve selected a few mixer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dbca-wa / oim-cms / tracking / test_api.py View on Github external
def setUp(self):
        """Generate from FreshdeskTicket objects.
        """
        super(FreshdeskTicketResourceTestCase, self).setUp()
        mixer.cycle(5).blend(
            FreshdeskContact, email=random_dbca_email)
        mixer.cycle(5).blend(
            FreshdeskTicket,
            subject=mixer.RANDOM, description_text=mixer.RANDOM, type='Test',
            freshdesk_requester=mixer.SELECT,
            it_system=mixer.SELECT,
            custom_fields={
                'support_category': None, 'support_subcategory': None},
        )
        self.ticket = FreshdeskTicket.objects.first()
github dbca-wa / oim-cms / approvals / test_views.py View on Github external
def setUp(self):
        # Create User and linked DepartmentUser objects.
        self.du1 = mixer.blend(DepartmentUser, username=mixer.RANDOM, photo=None)
        self.user1 = User.objects.create_user(
            username=self.du1.username, email=self.du1.email)
        self.user1.set_password('pass')
        self.user1.save()
        # Log in user1 by default.
        self.client.login(username=self.user1.username, password='pass')
        self.du2 = mixer.blend(DepartmentUser, username=mixer.RANDOM, photo=None)
        self.user2 = User.objects.create_user(
            username=self.du2.username, email=self.du2.email)
        self.user2.set_password('pass')
        self.user2.save()
github dbca-wa / oim-cms / knowledge / test_views.py View on Github external
def setUp(self):
        # Create User and linked DepartmentUser objects.
        self.du1 = mixer.blend(DepartmentUser, username=mixer.RANDOM, photo=None)
        self.user1 = User.objects.create_user(
            username=self.du1.username, email=self.du1.email)
        self.user1.is_superuser = True
        self.user1.set_password('pass')
        self.user1.save()
        # Log in user1 by default.
        self.client.login(username=self.user1.username, password='pass')
        self.du2 = mixer.blend(DepartmentUser, username=mixer.RANDOM, photo=None)
        self.user2 = User.objects.create_user(
            username=self.du2.username, email=self.du2.email)
        self.user2.set_password('pass')
        self.user2.save()

        self.itsystem = mixer.blend(ITSystem)
github dbca-wa / oim-cms / catalogue / test_api.py View on Github external
def setUp(self):
        # Generate a test user for endpoint responses.
        self.testuser = User.objects.create_user(
            username='testuser', email='user@dbca.wa.gov.au.com', password='pass')
        # Log in testuser by default.
        self.client.login(username='testuser', password='pass')
        # Generate some Record objects.
        mixer.cycle(8).blend(Record, title=mixer.RANDOM)
github dbca-wa / oim-cms / approvals / test_views.py View on Github external
def setUp(self):
        # Create User and linked DepartmentUser objects.
        self.du1 = mixer.blend(DepartmentUser, username=mixer.RANDOM, photo=None)
        self.user1 = User.objects.create_user(
            username=self.du1.username, email=self.du1.email)
        self.user1.set_password('pass')
        self.user1.save()
        # Log in user1 by default.
        self.client.login(username=self.user1.username, password='pass')
        self.du2 = mixer.blend(DepartmentUser, username=mixer.RANDOM, photo=None)
        self.user2 = User.objects.create_user(
            username=self.du2.username, email=self.du2.email)
        self.user2.set_password('pass')
        self.user2.save()
github dbca-wa / oim-cms / knowledge / test_views.py View on Github external
def setUp(self):
        # Create User and linked DepartmentUser objects.
        self.du1 = mixer.blend(DepartmentUser, username=mixer.RANDOM, photo=None)
        self.user1 = User.objects.create_user(
            username=self.du1.username, email=self.du1.email)
        self.user1.is_superuser = True
        self.user1.set_password('pass')
        self.user1.save()
        # Log in user1 by default.
        self.client.login(username=self.user1.username, password='pass')
        self.du2 = mixer.blend(DepartmentUser, username=mixer.RANDOM, photo=None)
        self.user2 = User.objects.create_user(
            username=self.du2.username, email=self.du2.email)
        self.user2.set_password('pass')
        self.user2.save()

        self.itsystem = mixer.blend(ITSystem)
github dbca-wa / oim-cms / oim_cms / test_api.py View on Github external
def setUp(self):
        # Generate some other DepartmentUser objects.
        mixer.cycle(8).blend(
            DepartmentUser, username=mixer.RANDOM, photo=None, active=True,
            email=random_dbca_email, org_unit=None,
            cost_centre=None, ad_guid=uuid1, o365_licence=False, in_sync=False)
        # Generate some locations.
        self.loc1 = mixer.blend(Location, manager=None)
        self.loc2 = mixer.blend(Location, manager=None)
        # Generate a basic org structure.
        # NOTE: don't use mixer to create OrgUnit objects (it breaks MPTT).
        self.dept = OrgUnit.objects.create(name='Department 1', unit_type=0, acronym='DEPT', active=True)
        self.div1 = OrgUnit.objects.create(
            name='Divison 1', unit_type=1, parent=self.dept, location=self.loc1, acronym='DIV1', active=True)
        self.branch1 = OrgUnit.objects.create(
            name='Branch 1', unit_type=2, parent=self.div1, location=self.loc1, acronym='BRANCH1', active=True)
        self.cc1 = CostCentre.objects.create(
            name='Cost centre 1', code='001', division=self.div1, org_position=self.div1)
        self.div2 = OrgUnit.objects.create(
            name='Divison 2', unit_type=1, parent=self.dept, location=self.loc2, acronym='DIV2', active=True)
github dbca-wa / oim-cms / oim_cms / test_api.py View on Github external
self.shared = users[4]
        self.shared.account_type = 5  # Shared account type.
        self.shared.org_unit = self.div1
        self.shared.cost_centre = self.cc1
        self.shared.save()
        # Make a user that doesn't manage a division.
        self.user3 = users[5]
        self.user3.org_unit = self.div1
        self.user3.cost_centre = self.cc1
        self.user3.save()
        # Generate a test user for endpoint responses.
        self.testuser = User.objects.create_user(
            username='testuser', email='user@dbca.wa.gov.au.com', password='pass')
        # Create a DepartmentUser object for testuser.
        mixer.blend(
            DepartmentUser, username=mixer.RANDOM, photo=None, active=True, email=self.testuser.email,
            org_unit=None, cost_centre=None, ad_guid=uuid1)
        # Log in testuser by default.
        self.client.login(username='testuser', password='pass')
github DimaKudosh / django-prepared-query / demo / books / management / commands / fill_db.py View on Github external
def handle(self, *args, **options):
        publishers = mixer.cycle(15).blend(Publisher)
        authors = mixer.cycle(50).blend(Author, age=(i for i in range(20, 70)))
        books = mixer.cycle(1000).blend(Book, pubdate=datetime.now(), authors=mixer.RANDOM, publisher=mixer.SELECT)