How to use the mixer.backend.django.mixer 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 / registers / test_api.py View on Github external
def setUp(self):
        super(ITSystemEventResourceTestCase, self).setUp()
        # Create some events
        self.event_current = mixer.blend(ITSystemEvent, planned=False, start=timezone.now())
        self.event_past = mixer.blend(
            ITSystemEvent, planned=True, start=timezone.now() - timedelta(hours=1),
            end=timezone.now(), current=False)
github jauhararifin / ugrade / server / contests / auth / test_core.py View on Github external
def test_get_all_permissions():
    mixer.cycle(5).blend('contests.Permission')
    assert len(get_all_permissions()) == 5
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 GatorIncubator / gatorgrouper / tests / test_models.py View on Github external
def test_str(self):
        """test __str__ method by putting varibles into the database and
        expecting the output to be in a specific format"""
        obj = mixer.blend("gatorgrouper.Professor", last_name="K", first_name="Greg")
        result = str(obj)
        expected = "K, Greg"
        assert result == expected
github GatorIncubator / gatorgrouper / tests / test_views.py View on Github external
def test_create_classes_post(self):
        """undocumented"""
        prof_obj = mixer.blend("gatorgrouper.Professor")
        obj = mixer.blend(
            "gatorgrouper.Semester_Class",
            professor_id=prof_obj,
            semester="S19",
            department="CS",
            class_number="CS101",
            class_section="01",
        )
        testdata = {
            "professor_id": prof_obj.professor_id,
            "class_id": obj.class_id,
            "semester": "S19",
            "department": "CS",
            "class_number": "CS101",
            "class_section": "01",
        }
github se-curriculum-design-group / 2019-Software-Engineering-Curriculum-Design / EMS / courseSelection / tests.py View on Github external
def setUp(self) -> None:
        student1 = mixer.blend(Student)
        student1.username = '2016000474'
        student1.password = make_encode('2016000474')
        student1.save()
        self.login_data = {
            'username': student1.username,
            'password': student1.username
        }
        data = {
            'username': '2016000474',
            'password': '2016000474'
        }

        url = ""
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'login.html')
github klen / adrest / tests / main / tests.py View on Github external
def setUp(self):
        self.author = mixer.blend('main.author')
        self.book = mixer.blend('main.book', author=self.author)
github jauhararifin / ugrade / server / contests / auth / test_core.py View on Github external
def test_get_user_by_username():
    contest1 = mixer.blend('contests.Contest', id=1, name='Contest 1')
    mixer.blend('contests.Contest', id=2, name='Contest 2')
    mixer.blend('contests.User', name='Test 1',
                username='username1', contest=contest1)
    mixer.blend('contests.User', name='Test 2',
                username='username2', contest=contest1)

    assert get_user_by_username(1, 'username1').name == 'Test 1'
    assert get_user_by_username(1, 'username2').name == 'Test 2'
    with pytest.raises(NoSuchUserError):
        get_user_by_username(1, 'nonexistent')
    with pytest.raises(NoSuchUserError):
        get_user_by_username(2, 'username2')
    with pytest.raises(NoSuchContestError):
        get_user_by_username(3, 'username1')