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

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

src/p/o/portfoliyo-HEAD/portfoliyo/tests/sms/test_hook.py   portfoliyo(Download)
def test_create_post(db):
    """Creates Post (and no reply) if one associated student."""
    phone = '+13216430987'
    profile = factories.ProfileFactory.create(phone=phone)
    rel = factories.RelationshipFactory.create(from_profile=profile)
def test_activate_user(db):
    """Receiving SMS from inactive user activates and gives them more info."""
    phone = '+13216430987'
    profile = factories.ProfileFactory.create(
        user__is_active=False, phone=phone, declined=True)
def test_decline(db):
    """If an inactive user replies with 'stop', they are marked declined."""
    phone = '+13216430987'
    profile = factories.ProfileFactory.create(
        user__is_active=False, phone=phone)
def test_active_user_decline(db):
    """If an active user replies with 'stop', they are marked declined."""
    phone = '+13216430987'
    profile = factories.ProfileFactory.create(
        user__is_active=True, phone=phone)
def test_multiple_students(db):
    """If multiple associated students, post goes in both villages."""
    phone = '+13216430987'
    profile = factories.ProfileFactory.create(phone=phone)
    rel1 = factories.RelationshipFactory.create(from_profile=profile)

src/p/o/portfoliyo-HEAD/portfoliyo/tests/view/village/test_forms.py   portfoliyo(Download)
    def test_edit_family_member(self, db):
        """Can edit a family member's name."""
        phone = '+13216540987'
        parent = factories.ProfileFactory.create(
            phone=phone, name='Old Name', role='dad')
            )
        assert form.is_valid(), dict(form.errors)
        assert parent == form.save(editor=factories.ProfileFactory.create())
        parent = utils.refresh(parent)
        assert parent.name == 'New Name'
            )
        assert form.is_valid(), dict(form.errors)
        profile = form.save(editor=factories.ProfileFactory.create())
 
        assert profile.role == "mom"
            )
        assert form.is_valid(), dict(form.errors)
        profile = form.save(editor=factories.ProfileFactory.create())
 
        assert profile.role == "aunt"
            )
        assert form.is_valid(), dict(form.errors)
        profile = form.save(editor=factories.ProfileFactory.create())
 
        assert profile.role == "aunt"

src/p/o/portfoliyo-HEAD/portfoliyo/tests/notifications/render/test_base.py   portfoliyo(Download)
    request.addfinalizer(patcher2.stop)
 
    return factories.ProfileFactory.create(**kw)
 
 
 
class TestSend(object):
    def test_send_only_if_email(self, db):
        """If user has no email, notifications not queried or sent."""
        p = factories.ProfileFactory.create(user__email=None)
    def test_send_only_if_active(self, db):
        """If user is inactive, notifications not queried or sent."""
        p = factories.ProfileFactory.create(
            user__email='foo@example.com', user__is_active=False)
        assert not base.send(p.id)
    def test_send_only_if_notifications(self, db, redis):
        """If there are no notifications, don't try to send an email."""
        p = factories.ProfileFactory.create(
            user__email='foo@example.com', user__is_active=True)
        assert not base.send(p.id)
            if teacher_name not in name_map:
                name_map[teacher_name] = factories.ProfileFactory.create(
                    name=teacher_name, school_staff=True)
            if student_name not in name_map:
                name_map[student_name] = factories.ProfileFactory.create(

src/p/o/portfoliyo-HEAD/portfoliyo/tests/api/test_resources.py   portfoliyo(Download)
    def test_ordering(self, no_csrf_client):
        """Users ordered alphabetically."""
        p = factories.ProfileFactory.create(name='B', school_staff=True)
        factories.ProfileFactory.create(name='A', school=p.school)
 
    def test_only_see_same_school_users(self, no_csrf_client):
        """Users can only see other users from same school in API."""
        p1 = factories.ProfileFactory.create()
        factories.ProfileFactory.create()
        hero = factories.ProfileFactory.create(
            school_staff=True, school=p1.school)

src/p/o/portfoliyo-HEAD/portfoliyo/tests/view/village/test_views.py   portfoliyo(Download)
    def test_contains_pdf_link(self, client):
        """Add student page contains link to parent instructions PDF."""
        p = factories.ProfileFactory.create(code='ABCDEF', school_staff=True)
        pdf_link = reverse('pdf_parent_instructions', kwargs={'lang': 'en'})
        response = client.get(reverse('add_student'), user=p.user)
    def test_add_student(self, client):
        """User can add a student."""
        teacher = factories.ProfileFactory.create(school_staff=True)
        form = client.get(
            reverse('add_student'), user=teacher.user).forms['add-student-form']
    def test_validation_error(self, client):
        """Name of student must be provided."""
        teacher = factories.ProfileFactory.create(school_staff=True)
        form = client.get(
            reverse('add_student'), user=teacher.user).forms['add-student-form']
    def test_requires_school_staff(self, client):
        """Adding a student requires ``school_staff`` attribute."""
        someone = factories.ProfileFactory.create(school_staff=False)
        response = client.get(
            reverse('add_student'), user=someone.user, status=302).follow()
    def url(self, student=None):
        """Shortcut to get URL of edit-student view."""
        if student is None:
            student = factories.ProfileFactory.create()
        return reverse('edit_student', kwargs={'student_id': student.id})

src/p/o/portfoliyo-HEAD/portfoliyo/tests/view/users/test_views.py   portfoliyo(Download)
    def test_login(self, client):
        """Successful login redirects."""
        factories.ProfileFactory.create(
            user__email='test@example.com', user__password='sekrit')
 
    def test_login_failed(self, client):
        """Failed login returns error message."""
        factories.ProfileFactory.create(
            user__email='test@example.com', user__password='sekrit')
 
    def test_good_captcha(self, client):
        """Good value for captcha allows login."""
        factories.ProfileFactory.create(
            user__email='test@example.com', user__password='sekrit')
 
    def test_logout_redirect(self, client):
        """Successful logout POST redirects to the home page."""
        profile = factories.ProfileFactory.create()
 
        url = reverse('no_students')
    def test_change_password(self, client):
        """Get a confirmation message after changing password."""
        profile = factories.ProfileFactory.create(user__password='sekrit')
        form = client.get(
            self.url, user=profile.user).forms['change-password-form']

src/p/o/portfoliyo-HEAD/portfoliyo/tests/model/users/test_bulk.py   portfoliyo(Download)
def teacher(db):
    return f.ProfileFactory.create(
        school_staff=True, user__email='teacher@example.com')
 
 
def test_skip_found(csvfile, teacher):
    p = f.ProfileFactory.create(name='Second Person', phone='+13336660000')
    s = f.ProfileFactory.create(name='Second Person')
    f.RelationshipFactory.create(to_profile=s, from_profile=teacher)
    f.RelationshipFactory.create(to_profile=s, from_profile=p)

src/p/o/portfoliyo-HEAD/portfoliyo/tests/model/users/test_auth_backend.py   portfoliyo(Download)
def test_authenticate_select_related(db):
    """authenticate method returns user with profile pre-selected."""
    factories.ProfileFactory.create(
        user__email='test@example.com', user__password='testpw')
    backend = auth_backend.EmailBackend()
def test_get_user_select_related(db):
    """get_user method returns user with profile pre-selected."""
    profile = factories.ProfileFactory.create()
    backend = auth_backend.EmailBackend()
    user = backend.get_user(profile.user.id)

src/p/o/portfoliyo-HEAD/portfoliyo/tests/landing/test_admin.py   portfoliyo(Download)
def test_lead_changelist(client):
    """The Lead admin changelist loads successfully."""
    admin = factories.ProfileFactory.create(
        user__is_staff=True, user__is_superuser=True)
    client.get(
def test_lead_change(client):
    """The Lead admin change page loads successfully."""
    admin = factories.ProfileFactory.create(
        user__is_staff=True, user__is_superuser=True)
    lead = LeadFactory.create()

src/p/o/portfoliyo-HEAD/portfoliyo/tests/model/users/test_models.py   portfoliyo(Download)
    def test_site_staff_are_school_staff(self, db):
        """Any user with is_staff is also school_staff."""
        user = factories.UserFactory.create(is_staff=True)
        profile = factories.ProfileFactory.create(user=user)
 
    def test_all_elders(self, db):
        """Queryset of elders of students in group, ordered by name."""
        rel = factories.RelationshipFactory.create(from_profile__name='B')
        e = factories.ProfileFactory.create(name='A')
        s = factories.ProfileFactory.create()
    def test_elder_relationships(self, db):
        """elder_relationships prop is all relationships of group students."""
        rel = factories.RelationshipFactory.create()
        e = factories.ProfileFactory.create()
        s = factories.ProfileFactory.create()

  1 | 2 | 3  Next