Skip to content

add mock and api-mock utils file and example #12

@gabbork

Description

@gabbork

Add python mock example and utils file like this one

 # tests/utils.py
  1 import io                                                                                                                 
  2 import json
  3 
  4 
  5 def get_fake_file(filename):
  6     with open(f'tests/data/{filename}', encoding='utf-8') as data_file:
  7         output = io.StringIO(data_file.read())
  8         return output
  9 
 10 
 11 def get_fake_json(filename):
 12     with open(f'tests/data/{filename}', encoding='utf-8') as data_file:
 13         return json.loads(data_file.read())

It's not directly related with BDD but very common and useful.
We also should add a Documentation section describing usage and examples.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions