Exemplo n.º 1
0
    def test_string_method(self):
        user1 = UserFactory(full_name='a b')
        user2 = UserFactory(full_name='c d')

        report = AbuseReportFactory(logged_against=user2,
                                    logged_by=user1)

        self.assertEqual(report.__str__(), 'Reported by a b against c d')
Exemplo n.º 2
0
    def setUp(self):
        site = get_current_site(self.client.request)
        site.config = SiteConfigFactory(site=site)

        self.closed_user = UserFactory(
            email='*****@*****.**',
            is_closed=True,
        )
        self.existing_user = UserFactory(email='*****@*****.**', )
Exemplo n.º 3
0
 def setUp(self):
     self.standard_user = UserFactory(email='*****@*****.**')
     self.factory = RequestFactory()
     self.site = get_current_site(self.client.request)
     self.site.config = SiteConfigFactory(site=self.site)
     self.closed_user = UserFactory(
         full_name='Closed',
         email='*****@*****.**',
         is_closed=True,
     )
Exemplo n.º 4
0
    def setUp(self):
        # Setup Roles
        self.mentor = RoleFactory(name='mentor')
        self.mentee = RoleFactory(name='mentee')

        self.standard_user = UserFactory()
        self.client.login(username=self.standard_user.email, password='******')
Exemplo n.º 5
0
 def setUp(self):
     self.moderator = ModeratorFactory()
     self.standard_user = UserFactory(
         full_name='Firsto Namo',
     )
     self.invited_pending = InvitedPendingFactory()
     self.requested_pending = RequestedPendingFactory()
Exemplo n.º 6
0
    def test_can_send_connect_email(self):
        subject = 'Test email'
        template = 'emails/email_base.html'
        recipient = UserFactory(email='*****@*****.**')
        site = SiteFactory(domain='mydomain.com')
        site.config = SiteConfigFactory(site=site)

        # Sender != from email, but rather the user who has sent the message
        sender = UserFactory(email='*****@*****.**')
        url = 'http://testurl.com'
        comments = 'comment',
        logged_against = UserFactory(email='*****@*****.**')

        email = send_connect_email(subject, template, recipient, site, sender,
                                   url, comments, logged_against)

        self.assertEqual(email, 1) # send_email returns no. of emails sent
Exemplo n.º 7
0
    def setUp(self):
        site = get_current_site(self.client.request)
        site.config = SiteConfigFactory(site=site)

        self.standard_user = UserFactory()

        # Setup skills
        self.django = SkillFactory(name='django')
        self.rails = SkillFactory(name='rails')
        self.jquery = SkillFactory(name='jquery')

        self.client.login(username=self.standard_user.email, password='******')
Exemplo n.º 8
0
    def setUp(self):
        self.standard_user = UserFactory()

        # Setup users with skills
        self.django = SkillFactory(name='django')
        self.rails = SkillFactory(name='rails')
        self.jquery = SkillFactory(name='jquery')

        self.mentor = RoleFactory(name='mentor')
        self.mentee = RoleFactory(name='mentee')

        self.user_1 = UserFactory(roles=[self.mentor,])
        UserSkillFactory(user=self.user_1, skill=self.django)

        self.user_2 = UserFactory(roles=[self.mentee,])
        UserSkillFactory(user=self.user_2, skill=self.django)
        UserSkillFactory(user=self.user_2, skill=self.rails)

        self.user_3 = UserFactory(roles=[self.mentor, self.mentee])
        UserSkillFactory(user=self.user_3, skill=self.rails)
        UserSkillFactory(user=self.user_3, skill=self.jquery)
Exemplo n.º 9
0
    def test_can_log_moderation_event(self):
        msg_type = ModerationLogMsg.INVITATION
        user = UserFactory()
        moderator = ModeratorFactory()
        comment = 'This is my comment'

        log = log_moderator_event(msg_type=user,
                                  user=user,
                                  moderator=moderator,
                                  comment=comment)

        logs = ModerationLogMsg.objects.all()

        self.assertIn(log, logs)
Exemplo n.º 10
0
    def test_can_match_link_to_brand(self):
        github = BrandFactory()
        link_user = UserFactory()
        link = UserLinkFactory(
            user=link_user,
            anchor='Github',
            url='http://github.com/myaccount/',
        )
        userlinks = [link]

        match_link_to_brand(userlinks)
        link = UserLink.objects.get(user=link_user)

        self.assertEqual(link.icon, github)
Exemplo n.º 11
0
def impl(context):

    role1 = Role.objects.get(name='role1')
    role2 = Role.objects.get(name='role2')

    skill1 = Skill.objects.get(name='skill1')
    skill2 = Skill.objects.get(name='skill2')

    user1 = UserFactory(email='*****@*****.**')
    user1_skill1 = UserSkillFactory(user=user1, skill=skill1)
    user1_skill2 = UserSkillFactory(user=user1, skill=skill2)

    user2 = UserFactory(email='*****@*****.**', roles=[role1, role2])

    user3 = UserFactory(email='*****@*****.**', roles=[
        role1,
    ])
    user3_skill1 = UserSkillFactory(user=user3, skill=skill1)

    user4 = UserFactory(email='*****@*****.**')
    user4_skill2 = UserSkillFactory(user=user4, skill=skill2)

    user5 = UserFactory(email='*****@*****.**', roles=[
        role2,
    ])
    user5_skill1 = UserSkillFactory(user=user5, skill=skill1)
    user5_skill2 = UserSkillFactory(user=user5, skill=skill2)

    user6 = UserFactory(email='*****@*****.**', roles=[role1, role2])
    user6_skill1 = UserSkillFactory(user=user6, skill=skill1)
    user6_skill2 = UserSkillFactory(user=user6, skill=skill2)

    user7 = UserFactory(email='*****@*****.**', roles=[
        role1,
    ])
    user7_skill2 = UserSkillFactory(user=user7, skill=skill2)
Exemplo n.º 12
0
    def setUp(self):
        site = get_current_site(self.client.request)
        site.config = SiteConfigFactory(site=site)

        self.standard_user = UserFactory()
        self.client.login(username=self.standard_user.email, password='******')
Exemplo n.º 13
0
 def setUp(self):
     self.standard_user = UserFactory()
Exemplo n.º 14
0
def impl(context):
    context.execute_steps('''
        given there is a standard user in the database
    ''')
    context.standard_user2 = UserFactory(full_name='Another User',
                                         email='*****@*****.**')
Exemplo n.º 15
0
    def test_string_method(self):
        user = UserFactory(full_name='a b')
        skill = SkillFactory(name='MySkill')
        user_skill = UserSkillFactory(user=user, skill=skill)

        self.assertEqual(user_skill.__str__(), 'a b - MySkill')
Exemplo n.º 16
0
def impl(context):
    context.closed_user = UserFactory(full_name='Closed User',
                                      email='*****@*****.**',
                                      is_active=False,
                                      is_closed=True)
Exemplo n.º 17
0
 def setUp(self):
     self.existing_user = UserFactory(email='*****@*****.**')
Exemplo n.º 18
0
 def setUp(self):
     self.user = UserFactory(email='*****@*****.**')
Exemplo n.º 19
0
 def setUp(self):
     self.standard_user = UserFactory(email='*****@*****.**')
Exemplo n.º 20
0
 def setUp(self):
     self.standard_user = UserFactory(email='*****@*****.**')
     self.existing_user = UserFactory(email='*****@*****.**')
Exemplo n.º 21
0
def impl(context):
    context.standard_user = UserFactory(full_name='Standard User',
                                        email='*****@*****.**',
                                        auth_token='123456')