Skip to content

Commit

Permalink
Make owner and name parameters of get_or_create_repository() not …
Browse files Browse the repository at this point in the history
…optional
  • Loading branch information
nsoranzo committed Oct 18, 2023
1 parent ab9906e commit 8288078
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/tool_shed/test/base/twilltestcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def login(
)
# v2 doesn't log you in on account creation... so force a login here
if previously_created or self.is_v2:
# The acount has previously been created, so just login.
# The account has previously been created, so just login.
# HACK: don't use panels because late_javascripts() messes up the twill browser and it
# can't find form fields (and hence user can't be logged in).
params = {"use_panels": False}
Expand Down Expand Up @@ -1402,21 +1402,20 @@ def get_repositories_category_api(
self.check_for_strings(strings_displayed, strings_not_displayed)

def get_or_create_repository(
self, category: Category, owner=None, strings_displayed=None, strings_not_displayed=None, **kwd
self, category: Category, owner: str, name: str, strings_displayed=None, strings_not_displayed=None, **kwd
) -> Optional[Repository]:
# If not checking for a specific string, it should be safe to assume that
# we expect repository creation to be successful.
if strings_displayed is None:
strings_displayed = ["Repository", kwd["name"], "has been created"]
strings_displayed = ["Repository", name, "has been created"]
if strings_not_displayed is None:
strings_not_displayed = []
name = kwd["name"]
repository = self.populator.get_repository_for(owner, name)
category_id = category.id
assert category_id
if repository is None:
category_id = category.id
assert category_id
self.visit_url("/repository/create_repository")
self.submit_form(button="create_repository_button", category_id=category_id, **kwd)
self.submit_form(button="create_repository_button", name=name, category_id=category_id, **kwd)
self.check_for_strings(strings_displayed, strings_not_displayed)
repository = self.populator.get_repository_for(owner, name)
return repository
Expand Down

0 comments on commit 8288078

Please sign in to comment.