Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(9)  |  Derive(0)  |  Import(0)

src/p/o/portfoliyo-HEAD/portfoliyo/tests/view/village/test_forms.py   portfoliyo(Download)
        form = forms.AddStudentForm({'name': "Some Student"}, elder=elder)
        assert form.is_valid(), dict(form.errors)
        profile = form.save()
        rel = profile.elder_relationships.get()
 
        assert form.is_valid(), (
            dict(form.errors), dict(form.family_form.errors))
        profile = form.save()
        family = profile.elder_relationships.exclude(
            from_profile=teacher).get().elder
        form = forms.AddStudentForm({'name': "  Some Student\t"}, elder=elder)
        assert form.is_valid(), dict(form.errors)
        profile = form.save()
 
        assert profile.name == u"Some Student"
        target = 'portfoliyo.pusher.events.student_added'
        with mock.patch(target) as mock_student_added:
            profile = form.save()
 
        mock_student_added.assert_called_with(profile.id, [elder.id])
 
        assert form.is_valid(), dict(form.errors)
        profile = form.save()
 
        assert set(profile.elders) == {elder, other_elder}