I have just installed Freshen and am trying to get the hang of it.
The following test runs, but the output it gives is incorrect.
Test: get_user.feature
Feature: Retrieve an existing User
When a Users ID (ID, Email, User-name) is entered,
An object containing all the Users information is returned
Scenario: Get existing User from their ID
Given I have the user where their id is '288' and account id is '57'
Then their username should equal adminuserxxx
steps.py
from freshen import *
from freshen.checks import *
import user_operations
import util
#The URL of the API
api_root = "http://api.stuff.com/v1/core";
#The ID of the Application
appid = "1234567";
#Our private key
secret = "987654321";
#Headers
headers = {'Accept':'application/json', 'Content-Type':'application/json'}
@Before
def before(sc):
scc.headers = headers
util.get_auth_token_and_scope(api_root, appid, secret, scc.headers) #An authorization token is added to scc.headers here
@Given("I have the user where their id is (\d+) and account id is (\d+)")
def enter(user_id,account_id):
scc.user = user_operations.get_user_from_id(int(account_id), int(user_id), scc.headers)
@Then("their (\w+) should equal (\w+)")
def check_result(field_value, result):
assert_equal(str(result),scc.user[str(field_name)])
And the console output:
C:\Users\Front-End>nosetests --with-freshen -v features\
Retrieve an existing User: Get existing User from their ID ... UNDEFINED: "I hav
e the user where their id is '288' and account id is '57'" # features\get_user.f
eature:6
----------------------------------------------------------------------
Ran 1 test in 0.137s
OK (UNDEFINED=1)
Can anybody point at what I am doing wrong? Cheers!
the feature should have this syntax (Given I have the user where their id is 288 and account id is 57 ) if you use (\d+) ...(\d+) in the @Given function
M.Harbaoui