How to use the impostor.models.ImpostorLog.objects.create function in Impostor

To help you get started, we’ve selected a few Impostor 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 samastur / Impostor / tests / test_impostor.py View on Github external
def test_impersonated_as_tag(self, real_admin, real_user, rf, in_session, expected):
        obj = ImpostorLog.objects.create(impostor=real_admin, imposted_as=real_user)
        setattr(rf, 'session', {})
        if in_session:
            rf.session['impostor_token'] = obj.token
        result = get_impersonated_as(rf)
        if expected:
            assert result == obj
        else:
            assert result != obj
github samastur / Impostor / tests / test_impostor.py View on Github external
def test_impostor_log_str(self, real_admin, real_user):
        obj = ImpostorLog.objects.create(impostor=real_admin, imposted_as=real_user)
        assert str(obj) == '{} as {}'.format(real_admin.username, real_user.username)