Skip to content

Commit

Permalink
restore api_id change
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeWang1127 committed May 11, 2024
1 parent aac204b commit d473f02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
29 changes: 0 additions & 29 deletions library_generation/test/utilities_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,6 @@
library_name="secretmanager",
gapic_configs=list(),
)
library_with_empty_api_id = LibraryConfig(
api_shortname="baremetalsolution",
name_pretty="Bare Metal Solution",
product_documentation="https://cloud.google.com/bare-metal/docs",
api_description="Bring your Oracle workloads to Google Cloud with Bare Metal Solution and jumpstart your cloud journey with minimal risk.",
gapic_configs=list(),
library_name="bare-metal-solution",
rest_documentation="https://cloud.google.com/bare-metal/docs/reference/rest",
rpc_documentation="https://cloud.google.com/bare-metal/docs/reference/rpc",
api_id="",
)


class UtilitiesTest(unittest.TestCase):
Expand Down Expand Up @@ -351,24 +340,6 @@ def test_generate_prerequisite_files_monorepo_success(self):
)
self.__remove_prerequisite_files(path=library_path)

def test_generate_prerequisite_files_with_empty_api_id_success(self):
library_path = self.__setup_prerequisite_files(
combination=3, library=library_with_empty_api_id
)

file_comparator.compare_files(
f"{library_path}/.repo-metadata.json",
f"{library_path}/.repo-metadata-empty-api-id-golden.json",
)
file_comparator.compare_files(
f"{library_path}/.OwlBot-hermetic.yaml",
f"{library_path}/.OwlBot-hermetic-golden.yaml",
)
file_comparator.compare_files(
f"{library_path}/owlbot.py", f"{library_path}/owlbot-golden.py"
)
self.__remove_prerequisite_files(path=library_path)

def test_prepare_repo_monorepo_success(self):
gen_config = self.__get_a_gen_config(2)
repo_config = util.prepare_repo(
Expand Down
13 changes: 3 additions & 10 deletions library_generation/utils/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from library_generation.utils.proto_path_utils import remove_version_from

script_dir = os.path.dirname(os.path.realpath(__file__))
EMPTY_API_ID = ""


def create_argument(arg_key: str, arg_container: object) -> List[str]:
Expand Down Expand Up @@ -217,12 +216,9 @@ def generate_prerequisite_files(
if config.is_monorepo()
else f"googleapis/{language}-{library_name}"
)
if library.api_id == EMPTY_API_ID:
api_id = None
elif not library.api_id:
api_id = f"{library.api_shortname}.googleapis.com"
else:
api_id = library.api_id
api_id = (
library.api_id if library.api_id else f"{library.api_shortname}.googleapis.com"
)
client_documentation = (
library.client_documentation
if library.client_documentation
Expand Down Expand Up @@ -255,9 +251,6 @@ def generate_prerequisite_files(
"requires_billing": library.requires_billing,
}

if not repo_metadata["api_id"]:
repo_metadata.pop("api_id")

if library.api_reference:
repo_metadata["api_reference"] = library.api_reference
if library.codeowner_team:
Expand Down

0 comments on commit d473f02

Please sign in to comment.