Skip to content

Commit

Permalink
issue #114 - conftest.py - sanitize MFA codes
Browse files Browse the repository at this point in the history
  • Loading branch information
jantman committed Feb 12, 2016
1 parent 5fae4a3 commit ac6224e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions awslimitchecker/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

import sys
import os
import re

from _pytest.terminal import TerminalReporter
import pytest
Expand All @@ -55,6 +56,8 @@
class OutputSanitizer(object):

def __init__(self, tw):
self.mfa_re = re.compile(r"'mfa_token':\s*b?'\d+'")
self.tc_re = re.compile(r"'TokenCode':\s*b?'\d+'")
self._tw = tw
self.replace = []
for keyname in [
Expand Down Expand Up @@ -83,6 +86,8 @@ def line(self, s='', **kw):
def sanitize_line(self, line):
for repl_set in self.replace:
line = line.replace(repl_set[0], repl_set[1])
line = self.mfa_re.sub("'mfa_token': 'XXXXXX", line)
line = self.tc_re.sub("'TokenCode': 'XXXXXX", line)
return line

def sep(self, *args, **kwargs):
Expand Down

0 comments on commit ac6224e

Please sign in to comment.