@@ -64,3 +64,59 @@ def test_get_sorted_gapic_configs_returns_correct_order(self):
64
64
],
65
65
library .get_sorted_gapic_configs (),
66
66
)
67
+
68
+ def test_init_invalid_distribution_name_raise_value_error (self ):
69
+ self .assertRaisesRegex (
70
+ ValueError ,
71
+ "fake-distribution-name is not a valid distribution name." ,
72
+ LibraryConfig ,
73
+ api_shortname = "baremetalsolution" ,
74
+ name_pretty = "Bare Metal Solution" ,
75
+ product_documentation = "https://cloud.google.com/bare-metal/docs" ,
76
+ api_description = "example api description" ,
77
+ gapic_configs = list (),
78
+ distribution_name = "fake-distribution-name" ,
79
+ )
80
+
81
+ def test_get_distribution_name_cloud_api (self ):
82
+ library = LibraryConfig (
83
+ api_shortname = "baremetalsolution" ,
84
+ name_pretty = "Bare Metal Solution" ,
85
+ product_documentation = "https://cloud.google.com/bare-metal/docs" ,
86
+ api_description = "example api description" ,
87
+ gapic_configs = list (),
88
+ )
89
+ self .assertEqual (
90
+ "com.google.cloud:google-cloud-baremetalsolution" ,
91
+ library .get_maven_coordinate (),
92
+ )
93
+ self .assertEqual ("google-cloud-baremetalsolution" , library .get_artifact_id ())
94
+
95
+ def test_get_distribution_name_non_cloud_api (self ):
96
+ library = LibraryConfig (
97
+ api_shortname = "baremetalsolution" ,
98
+ name_pretty = "Bare Metal Solution" ,
99
+ product_documentation = "https://cloud.google.com/bare-metal/docs" ,
100
+ api_description = "example api description" ,
101
+ gapic_configs = list (),
102
+ cloud_api = False ,
103
+ group_id = "com.example" ,
104
+ )
105
+ self .assertEqual (
106
+ "com.example:google-baremetalsolution" , library .get_maven_coordinate ()
107
+ )
108
+ self .assertEqual ("google-baremetalsolution" , library .get_artifact_id ())
109
+
110
+ def test_get_distribution_name_with_distribution_name (self ):
111
+ library = LibraryConfig (
112
+ api_shortname = "baremetalsolution" ,
113
+ name_pretty = "Bare Metal Solution" ,
114
+ product_documentation = "https://cloud.google.com/bare-metal/docs" ,
115
+ api_description = "example api description" ,
116
+ gapic_configs = list (),
117
+ distribution_name = "com.example:baremetalsolution" ,
118
+ )
119
+ self .assertEqual (
120
+ "com.example:baremetalsolution" , library .get_maven_coordinate ()
121
+ )
122
+ self .assertEqual ("baremetalsolution" , library .get_artifact_id ())
0 commit comments