Skip to content

Commit

Permalink
Merge pull request #129 from docusign/feature/fixes-for-selenium-tests
Browse files Browse the repository at this point in the history
Fixes for selenium tests
  • Loading branch information
meihDS authored Nov 29, 2023
2 parents c61579c + 6afae8e commit 7ccf4a6
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 23 deletions.
36 changes: 22 additions & 14 deletions app/admin/examples/eg004_add_users_via_bulk_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@


class Eg004AddUsersViaBulkImportController:
@staticmethod
def get_example_csv():
"""
Creates an example of a CSV file, such as that needs to be sent to the Docusign server
"""

# Returns an example of a CSV file
return (
"AccountID,UserName,UserEmail,PermissionSet\n"
f"{session['ds_account_id']},Example User1,exampleuser1@example.com,DS Admin\n"
f"{session['ds_account_id']},Example User2,exampleuser2@example.com,DS Admin\n"
)

@staticmethod
def worker(self, request):
Expand Down Expand Up @@ -35,7 +47,16 @@ def worker(self, request):
uploaded_file = request.files['csv_file']
csv_folder_path = path.abspath(path.join(path.dirname(path.realpath(__file__)), "csv"))
csv_file_path = path.join(csv_folder_path, "uploaded_file.csv")
uploaded_file.save(csv_file_path)

if uploaded_file and not uploaded_file.filename == '':
uploaded_file.save(csv_file_path)
else:
content = Eg004AddUsersViaBulkImportController.get_example_csv()

modified_content = content.replace("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", session["ds_account_id"])

with open(csv_file_path, "w") as file:
file.write(modified_content)

# Creating an import API object
#ds-snippet-start:Admin4Step3
Expand All @@ -57,19 +78,6 @@ def worker(self, request):

return response

@staticmethod
def get_example_csv():
"""
Creates an example of a CSV file, such as that needs to be sent to the Docusign server
"""

# Returns an example of a CSV file
return (
"AccountID,UserName,UserEmail,PermissionSet\n"
f"{session['ds_account_id']},Example User1,exampleuser1@example.com,DS Admin\n"
f"{session['ds_account_id']},Example User2,exampleuser2@example.com,DS Admin\n"
)

@staticmethod
def check_status():
"""Check request status"""
Expand Down
3 changes: 2 additions & 1 deletion app/click/examples/eg006_embed_clickwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def get_args():
"email": request.form.get("email"),
"company": request.form.get("company"),
"title": request.form.get("title"),
"date": request.form.get("date"),
"date": request.form.get("date"),
"statuses": ["inactive", "draft"]
}

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion app/click/views/eg004_list_clickwraps.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def clickwrap_list():
"example_done.html",
title=example["ExampleName"],
message="Results from the ClickWraps::getClickwraps method:",
json=json.dumps(json.dumps(results.to_dict(), default=str))
json=json.dumps(json.dumps(results, default=str))
)


Expand Down
2 changes: 1 addition & 1 deletion app/monitor/views/eg001_get_monitoring_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def get_monitoring_data():
"example_done.html",
title=example["ExampleName"],
message="Results from DataSet:getStream method:",
json=json.dumps(json.dumps(results, default=str))
json=json.dumps(json.dumps(results, default=str).replace('\\"', '').replace("'", ""))
)

@meg001.route(f"/{eg}", methods=["GET"])
Expand Down
2 changes: 1 addition & 1 deletion app/templates/admin/eg004_add_users_via_bulk_import.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<form class="eg" action="" method="post" data-busy="form" enctype="multipart/form-data">
<div class="form-group">
<input type="file" name="csv_file" required>
<input type="file" name="csv_file" id="csv_file">
</div>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
<button type="submit" class="btn btn-docu mt-4 mb-4">Continue</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

{% set form_index = 0 %}
{% set product_index = 0 %}
{% set esign_permission_index = 1 %}
{% set clm_permission_index = 2 %}
{% set permission_index = 1 %}
{% set redirect_to2_index = 0 %}

{% if email_ok %}
Expand All @@ -29,7 +28,7 @@

{% if esign_permission_profiles_list %}
<div class="form-group" id="esign-profiles" style="display: none">
<label for="esign_permission_profile">{{ example['Forms'][form_index]['Inputs'][esign_permission_index]['InputName'] }}</label>
<label for="esign_permission_profile">{{ example['Forms'][form_index]['Inputs'][permission_index]['InputName'] }}</label>
<select class="form-control" id="esign_permission_profile" name="esign_permission_profile">
{% for profile in esign_permission_profiles_list %}
<option value="{{profile.permission_profile_id}}">{{profile.permission_profile_name}}</option>
Expand All @@ -43,7 +42,7 @@

{% if clm_permission_profiles_list %}
<div class="form-group" id="clm-profiles">
<label for="clm_permission_profile">{{ example['Forms'][form_index]['Inputs'][clm_permission_index]['InputName'] }}</label>
<label for="clm_permission_profile">{{ example['Forms'][form_index]['Inputs'][permission_index]['InputName'] }}</label>
<select class="form-control" id="clm_permission_profile" name="clm_permission_profile">
{% for profile in clm_permission_profiles_list %}
<option value="{{profile.permission_profile_id}}">{{profile.permission_profile_name}}</option>
Expand Down
2 changes: 1 addition & 1 deletion app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
def index():
session["manifest"] = get_manifest(DS_CONFIG["example_manifest_url"])

if DS_CONFIG["quickstart"] == "true":
if DS_CONFIG["quickstart"] == "true" and ("quickstart" not in app.config or ( "quickstart" in app.config and app.config["quickstart"] == True)):
app.config["quickstart"] = False
return redirect(url_for("eg001.get_view"))
if "is_cfr" in session and session["is_cfr"] == "enabled":
Expand Down

0 comments on commit 7ccf4a6

Please sign in to comment.