keystone/keystone/tests/unit/auth/plugins
Lance Bragstad 93838575c1 Fix integer -> method conversion for python3
We have a method that takes an integer and re-inflates it into a list
of authentication methods. This is because it's more efficient to
pass around an integer in a token's payload than a list of strings.
During the token validation process, we take this integer and run it
through a little process to reinflate it's value to a list of auth
methods that were used to obtain the original token.

The re-inflation process doesn't actually work in python3 because it
is coded to expect integers when dividing numbers, which is accurate
for python2. Python3 returns floats when dividing two integers, which
doesn't work with the logic to re-inflate the auth methods. For
example, in python 3::

  >>> result = 5 / 4
  >>> result
  1.25
  >>> type(result)
  <class 'float'>

In python2:

  >>> result = 5 / 4
  >>> result
  1
  >>> type(result)
  <type 'int'>

This commit introduces unit tests to prevent regression and includes
a fix so that the conversion works properly on python3.

Closes-Bug: 1758121
Change-Id: I627c2b353da0c35bb23bb40542a880fc6bacc4aa
2018-03-22 18:13:24 +00:00
..
__init__.py Fix integer -> method conversion for python3 2018-03-22 18:13:24 +00:00
test_core.py Fix integer -> method conversion for python3 2018-03-22 18:13:24 +00:00