Ejemplo n.º 1
0
    def test_simple(self, mock_check_auth_identity):
        organization = self.create_organization(name='Test')
        user = self.create_user(email='*****@*****.**')
        auth_provider = AuthProvider.objects.create(
            organization=organization,
            provider='dummy',
        )
        OrganizationMember.objects.create(
            user=user,
            organization=organization,
            flags=getattr(OrganizationMember.flags, 'sso:linked'),
        )

        ai = AuthIdentity.objects.create(
            auth_provider=auth_provider,
            user=user,
            last_synced=timezone.now() - timedelta(days=1),
        )

        check_auth()

        updated_ai = AuthIdentity.objects.get(id=ai.id)
        assert updated_ai.last_synced != ai.last_synced
        # mysql doesnt store ms
        assert updated_ai.last_verified.replace(microsecond=0) == ai.last_verified.replace(microsecond=0)

        mock_check_auth_identity.apply_async.assert_called_once_with(
            kwargs={'auth_identity_id': ai.id},
            expires=AUTH_CHECK_INTERVAL,
        )
Ejemplo n.º 2
0
    def test_simple(self, mock_check_auth_identity):
        organization = self.create_organization(name='Test')
        user = self.create_user(email='*****@*****.**')
        auth_provider = AuthProvider.objects.create(
            organization=organization,
            provider='dummy',
        )
        OrganizationMember.objects.create(
            user=user,
            organization=organization,
            flags=OrganizationMember.flags['sso:linked'],
        )

        ai = AuthIdentity.objects.create(
            auth_provider=auth_provider,
            user=user,
            last_synced=timezone.now() - timedelta(days=1),
        )

        check_auth()

        updated_ai = AuthIdentity.objects.get(id=ai.id)
        assert updated_ai.last_synced != ai.last_synced
        # mysql doesnt store ms
        assert updated_ai.last_verified.replace(microsecond=0) == ai.last_verified.replace(
            microsecond=0
        )

        mock_check_auth_identity.apply_async.assert_called_once_with(
            kwargs={'auth_identity_id': ai.id},
            expires=AUTH_CHECK_INTERVAL,
        )
Ejemplo n.º 3
0
    def test_simple(self, mock_check_auth_identity):
        organization = self.create_organization(name="Test")
        user = self.create_user(email="*****@*****.**")
        auth_provider = AuthProvider.objects.create(organization=organization, provider="dummy")
        OrganizationMember.objects.create(
            user=user, organization=organization, flags=OrganizationMember.flags["sso:linked"]
        )

        ai = AuthIdentity.objects.create(
            auth_provider=auth_provider, user=user, last_synced=timezone.now() - timedelta(days=1)
        )

        check_auth()

        updated_ai = AuthIdentity.objects.get(id=ai.id)
        assert updated_ai.last_synced != ai.last_synced
        assert updated_ai.last_verified == ai.last_verified

        mock_check_auth_identity.apply_async.assert_called_once_with(
            kwargs={"auth_identity_id": ai.id}, expires=AUTH_CHECK_INTERVAL
        )