Minor tests improvements.
parent
ba9dd6a951
commit
1a9e698b56
|
@ -6,46 +6,40 @@ import os
|
||||||
# ===================================== Excel New =====================================
|
# ===================================== Excel New =====================================
|
||||||
@given(u'an Excel client')
|
@given(u'an Excel client')
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
|
context.path = os.getcwd()
|
||||||
context.client = Excel()
|
context.client = Excel()
|
||||||
|
|
||||||
@when(u'the Excel New method is called')
|
@when(u'the Excel New method is called')
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
path = os.getcwd()
|
context.new_return = context.client.new(context.path+"/test.xls", "")
|
||||||
context.new_return = context.client.new(path+"/test.xls", "")
|
|
||||||
|
|
||||||
@then(u'a new Excel sheet must be created')
|
@then(u'a new Excel sheet must be created')
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
path = os.getcwd()
|
assert context.new_return == "ok" and "test.xls" in os.listdir(context.path), "The Excel sheet was not created as expected."
|
||||||
assert context.new_return == "ok" and "test.xls" in os.listdir(path), "The Excel sheet was not created as expected."
|
|
||||||
|
|
||||||
|
|
||||||
# ===================================== Excel Write =====================================
|
# ===================================== Excel Write =====================================
|
||||||
@given(u'an Excel sheet')
|
@given(u'an Excel sheet')
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
path = os.getcwd()
|
context.new_return = context.client.new(context.path+"/test.xls", "")
|
||||||
context.new_return = context.client.new(path+"/test.xls", "")
|
|
||||||
|
|
||||||
@when(u'the Excel Write method is called on this sheet to write')
|
@when(u'the Excel Write method is called on this sheet to write')
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
path = os.getcwd()
|
context.write_return = context.client.write(context.path+"/test.xls", "Planilha1", "A1", "churros", "s")
|
||||||
context.write_return = context.client.write(path+"/test.xls", "Planilha1", "A1", "churros", "s")
|
|
||||||
|
|
||||||
@then(u'the writing must be successful')
|
@then(u'the writing must be successful')
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
path = os.getcwd()
|
assert context.write_return == "ok" and context.client.read(context.path+"/test.xls", "Planilha1")[0][0] == "churros", "The Write method failed unexpectedly."
|
||||||
assert context.write_return == "ok" and context.client.read(path+"/test.xls", "Planilha1")[0][0] == "churros", "The Write method failed unexpectedly."
|
|
||||||
|
|
||||||
|
|
||||||
# ===================================== Excel Read =====================================
|
# ===================================== Excel Read =====================================
|
||||||
@given(u'the text "churros" text written in the A1 cell')
|
@given(u'the text "churros" text written in the A1 cell')
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
path = os.getcwd()
|
context.write_return = context.client.write(context.path+"/test.xls", "Planilha1", "A1", "churros", "s")
|
||||||
context.write_return = context.client.write(path+"/test.xls", "Planilha1", "A1", "churros", "s")
|
|
||||||
|
|
||||||
@when(u'the Excel Read method is called')
|
@when(u'the Excel Read method is called')
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
path = os.getcwd()
|
context.read_return = context.client.read(context.path+"/test.xls", "Planilha1")
|
||||||
context.read_return = context.client.read(path+"/test.xls", "Planilha1")
|
|
||||||
|
|
||||||
@then(u'the word "churros" must be returned in the position [0][0]')
|
@then(u'the word "churros" must be returned in the position [0][0]')
|
||||||
def step_impl(context):
|
def step_impl(context):
|
||||||
|
|
Loading…
Reference in New Issue