You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
696 B
26 lines
696 B
7 years ago
|
import mainsource
|
||
|
|
||
|
|
||
|
class TestingSource(object):
|
||
|
def __init__(self):
|
||
|
self.username = None
|
||
|
self.password = None
|
||
|
self.last_exception = None
|
||
|
|
||
|
def set_username(self, username):
|
||
|
self.username = username
|
||
|
|
||
|
def set_password(self, password):
|
||
|
self.password = password
|
||
|
|
||
|
def create_user(self):
|
||
|
try:
|
||
|
mainsource.create_user(self.username, self.password)
|
||
|
except mainsource.UserCreationError as exc:
|
||
|
self.last_exception = exc
|
||
|
|
||
|
def is_invalid_password(self):
|
||
|
return (self.last_exception and
|
||
|
isinstance(self.last_exception,
|
||
|
mainsource.PasswordIsNotStrongEnough))
|