Julio Biason
7 years ago
5 changed files with 148 additions and 0 deletions
@ -1,3 +1,8 @@
|
||||
*.sw? |
||||
.DS_Store |
||||
index.json |
||||
*.pyc |
||||
*.xml |
||||
report.html |
||||
log.html |
||||
*.pdf |
||||
|
@ -0,0 +1,7 @@
|
||||
Feature: Testing passwords |
||||
|
||||
Scenario: Invalid password |
||||
Given that I have a username foo |
||||
And that I have a password test123 |
||||
When I try to create an user |
||||
Then I should get an error of invalid password |
@ -0,0 +1,34 @@
|
||||
# -*- encoding: utf-8 -*- |
||||
|
||||
"""Behave steps.""" |
||||
|
||||
import behave |
||||
import mainsource |
||||
|
||||
|
||||
@behave.given("that I have a username {name}") |
||||
def set_username(context, name): |
||||
context.username = name |
||||
return |
||||
|
||||
|
||||
@behave.given("that I have a password {password}") |
||||
def set_password(context, password): |
||||
context.password = password |
||||
return |
||||
|
||||
|
||||
@behave.when("I try to create an user") |
||||
def create_user(context): |
||||
try: |
||||
mainsource.create_user(context.username, context.password) |
||||
except mainsource.UserCreationError as exc: |
||||
context.last_exception = exc |
||||
return |
||||
|
||||
|
||||
@behave.then("I should get an error of invalid password") |
||||
def is_invalid_password(context): |
||||
assert hasattr(context, 'last_exception') |
||||
assert isinstance(context.last_exception, |
||||
mainsource.PasswordIsNotStrongEnough) |
Loading…
Reference in new issue