started tests

This commit is contained in:
Oleg Podsadny 2013-06-06 23:22:49 +02:00
parent 49909e76a7
commit 314dc05278
13 changed files with 87 additions and 2 deletions

View File

@ -1,7 +1,7 @@
Scenario: Successful login
Given I'm an admin user
When I open the login page
When I go to the admin login page
And I fill in the login credentials
And I post the form
@ -11,7 +11,7 @@ Scenario: Successful login
Scenario: Unsuccessful login
When I open the login page
When I go to the admin login page
And I fill in wrong login credentials
And I post the form

1
tests/fixtures/README.txt vendored Normal file
View File

@ -0,0 +1 @@
This should contain fixtures that are used in both functional and unit tests

0
tests/fixtures/__init__.py vendored Normal file
View File

View File

View File

View File

View File

@ -0,0 +1,48 @@
from pytest_bdd import scenario, given, when, then
test_successful_login = scenario(
'auth/admin_login.feature',
'Successful login',
)
@given('I\'m an admin user')
def admin_user(user):
pass
@when('I go to the admin login page')
def go_to_login_page(browser):
pass
@when('I fill in the login credentials')
def fill_in_login_credentials():
pass
@when('I post the form')
def post_the_form():
pass
@then('I shouldn\'t see an error message')
def shouldnt_see_error_message():
pass
@then('I should see the Dashboard page')
def should_see_dashboard():
pass
test_successful_login = scenario(
'auth/admin_login.feature',
'Unsuccessful login',
)
@when('I fill in wrong login credentials')
def fill_in_wrong_credentials():
pass

View File

@ -0,0 +1,15 @@
import os
import pytest
import pytest_bdd_example
from .fixtures.auth import *
@pytest.fixture
def pytestbdd_feature_base_dir():
"""Feature files base directory."""
return os.path.join(
os.path.dirname(
os.path.dirname(pytest_bdd_example.__file__)
), 'features', 'admin',
)

View File

@ -0,0 +1,6 @@
import pytest
@pytest.fixture
def password():
return 'asdasd'

View File

@ -0,0 +1,15 @@
import os
import pytest
import pytest_bdd_example
from .fixtures.auth import *
@pytest.fixture
def pytestbdd_feature_base_dir():
"""Feature files base directory."""
return os.path.join(
os.path.dirname(
os.path.dirname(pytest_bdd_example.__file__)
), 'features', 'shop',
)

View File

0
tests/unit/__init__.py Normal file
View File