Skip to content

Commit

Permalink
Merge pull request #111 from cherba/samples
Browse files Browse the repository at this point in the history
Consolidate gen test samples.
  • Loading branch information
craigcitro committed Jun 1, 2016
2 parents e26216d + 9edd3a7 commit 95c9f82
Show file tree
Hide file tree
Showing 22 changed files with 5,238 additions and 137 deletions.
31 changes: 0 additions & 31 deletions apitools/gen/gen_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,37 +43,6 @@ def testHelp_NotEnoughArguments(self):
self.assertIn('usage:', err_output)
self.assertIn('error: too few arguments', err_output)

def _CheckGeneratedFiles(self, api_name, api_version):
prefix = api_name + '_' + api_version
with test_utils.TempDir() as tmp_dir_path:
gen_client.main([
gen_client.__file__,
'--generate_cli',
'--init-file', 'empty',
'--infile',
GetTestDataPath(api_name, prefix + '.json'),
'--outdir', tmp_dir_path,
'--overwrite',
'--root_package', api_name,
'client'
])
expected_files = (
set([prefix + '.py']) | # CLI files
set([prefix + '_client.py',
prefix + '_messages.py',
'__init__.py']))
self.assertEquals(expected_files, set(os.listdir(tmp_dir_path)))
for expected_file in expected_files:
self.assertMultiLineEqual(
_GetContent(GetTestDataPath(api_name, expected_file)),
_GetContent(os.path.join(tmp_dir_path, expected_file)))

def testGenClient_DnsDoc(self):
self._CheckGeneratedFiles('dns', 'v1')

def testGenClient_IamDoc(self):
self._CheckGeneratedFiles('iam', 'v1')

def testGenClient_SimpleDocNoInit(self):
with test_utils.TempDir() as tmp_dir_path:
gen_client.main([
Expand Down
4 changes: 3 additions & 1 deletion run_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@

IGNORED_DIRECTORIES = [
'apitools/gen/testdata',
'samples/storage_sample/storage',
'samples/dns_sample/dns_v1',
'samples/iam_sample/iam_v1',
'samples/storage_sample/storage_v1',
'venv',
]
IGNORED_FILES = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#
# Copyright 2015 Google Inc.
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -12,15 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Common imports for generated storage client library."""
# pylint:disable=wildcard-import

import pkgutil

from apitools.base.py import *
from storage_v1 import *
from storage_v1_client import *
from storage_v1_messages import *

__path__ = pkgutil.extend_path(__path__, __name__)

0 comments on commit 95c9f82

Please sign in to comment.