def run(): responses.add(responses.GET, "http://example.com/one", body="test1") if isinstance(replacement, BaseResponse): responses.upsert(replacement) else: responses.upsert(responses.GET, replacement, body="testtwo") resp = requests.get("http://example.com/two") assert_response(resp, "testtwo")
def register(cls, data): responses.upsert("GET", cls.projects_url, json=cls.get_json_projects(data)) for project_id, project in enumerate(data, start=1): responses.upsert("GET", cls.columns_url.format(project_id=project_id), json=cls.get_json_columns(project, project_id)) for n, column in enumerate(project.get("columns", []), start=1): column_id = int(str(project_id) + str(n)) responses.upsert("GET", cls.cards_url.format(column_id=column_id), json=cls.get_json_cards(column, column_id))