Julio Biason
7 years ago
3 changed files with 191 additions and 4 deletions
@ -0,0 +1,25 @@ |
|||||||
|
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)) |
@ -0,0 +1,24 @@ |
|||||||
|
*** Settings *** |
||||||
|
Library TestingSource.py |
||||||
|
|
||||||
|
*** Test Cases *** |
||||||
|
Invalid password |
||||||
|
Given that I have a username foo |
||||||
|
And that I have a password test123 |
||||||
|
When I try to create a user |
||||||
|
Then I should get an error of invalid password |
||||||
|
|
||||||
|
*** Keywords *** |
||||||
|
That I have a username |
||||||
|
[Arguments] ${username} |
||||||
|
set username ${username} |
||||||
|
|
||||||
|
That I have a password |
||||||
|
[Arguments] ${password} |
||||||
|
Set password ${password} |
||||||
|
|
||||||
|
I try to create a user |
||||||
|
Create user |
||||||
|
|
||||||
|
I should get an error of invalid password |
||||||
|
Is invalid password |
Loading…
Reference in new issue