Add apache license to python files. closes #9

Project: http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/commit/c6cda06f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/tree/c6cda06f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/diff/c6cda06f

Branch: refs/heads/master
Commit: c6cda06fdefa2eb5ad9853d95c3a992fdedc4f93
Parents: c6afd57
Author: Ian Duffy <i...@ianduffy.ie>
Authored: Mon Apr 13 16:18:35 2015 +0100
Committer: Ian Duffy <i...@ianduffy.ie>
Committed: Mon Apr 13 16:18:35 2015 +0100

----------------------------------------------------------------------
 .travis.yml                          |   2 +-
 gstack/__init__.py                   |   5 +-
 gstack/configure.py                  |   3 +-
 gstack/controllers/__init__.py       |   9 +-
 gstack/controllers/images.py         |   3 +-
 gstack/controllers/index.py          |   3 +-
 gstack/controllers/instances.py      |  12 +-
 gstack/controllers/machine_type.py   |   3 +-
 gstack/controllers/networks.py       |   6 +-
 gstack/controllers/operations.py     |   6 +-
 gstack/oauth2provider.py             |   3 +-
 migrations/env.py                    |  35 ++++--
 migrations/versions/25c3e5241cd0_.py |  46 ++++++--
 migrations/versions/76bb287a37d_.py  | 111 +++++++++++-------
 pyoauth2/__init__.py                 |  20 ++++
 pyoauth2/client.py                   |  21 ++++
 pyoauth2/provider.py                 |  25 +++-
 pyoauth2/tests/__init__.py           |  20 ++++
 pyoauth2/tests/test_client.py        |  21 ++++
 pyoauth2/tests/test_integration.py   |  21 ++++
 pyoauth2/tests/test_provider.py      |  21 ++++
 pyoauth2/tests/test_utils.py         |  21 ++++
 pyoauth2/utils.py                    |  21 ++++
 setup.py                             |   4 +-
 tests/__init__.py                    |  36 ++++--
 tests/discovery_tests.py             |  21 +++-
 tests/disks_tests.py                 |  76 ++++++++----
 tests/firewalls_tests.py             |  74 ++++++++----
 tests/images_tests.py                |  48 ++++++--
 tests/instances_tests.py             | 188 +++++++++++++++++++-----------
 tests/machine_type_tests.py          |  69 ++++++++---
 tests/networks_tests.py              | 102 ++++++++++------
 tests/operations_tests.py            |  30 ++++-
 tests/project_tests.py               |  57 ++++++---
 tests/regions_tests.py               |  50 ++++++--
 tests/settings.py                    |  23 +++-
 tests/utils.py                       |  25 ++--
 tests/zones_tests.py                 |  48 ++++++--
 38 files changed, 970 insertions(+), 319 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index d799879..b5511e9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ install:
   - pip install coveralls
   - pip install -e . --use-mirrors
 script:
-  - pep8 --ignore=E501 *.py gstack
+  - pep8 --ignore=E501, E402 *.py gstack
   - pylint --rcfile=pylint.rc *.py gstack
   - nosetests --with-coverage --cover-erase --cover-package=gstack
 after_success:

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/gstack/__init__.py
----------------------------------------------------------------------
diff --git a/gstack/__init__.py b/gstack/__init__.py
index 6be6a06..a11423a 100644
--- a/gstack/__init__.py
+++ b/gstack/__init__.py
@@ -79,9 +79,8 @@ def _config_from_config_profile(config_file, profile):
     config.read(config_file)
 
     if not config.has_section(profile):
-        sys.exit('No profile matching ' + profile
-                 + ' found in configuration, please run gstack-configure -p '
-                 + profile)
+        sys.exit('No profile matching ' + profile +
+                 ' found in configuration, please run gstack-configure -p ' + 
profile)
 
     for attribute in config.options(profile):
         app.config[attribute.upper()] = config.get(profile, attribute)

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/gstack/configure.py
----------------------------------------------------------------------
diff --git a/gstack/configure.py b/gstack/configure.py
index 2bcf4bb..eeb5168 100644
--- a/gstack/configure.py
+++ b/gstack/configure.py
@@ -99,7 +99,8 @@ def _set_attribute_of_profile(config, profile, attribute, 
message, default):
     if config.has_option(profile, attribute):
         default = config.get(profile, attribute)
 
-    attribute_value = _read_in_config_attribute_or_use_default(message, 
default)
+    attribute_value = _read_in_config_attribute_or_use_default(
+        message, default)
 
     config.set(profile, attribute, attribute_value)
     return config

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/gstack/controllers/__init__.py
----------------------------------------------------------------------
diff --git a/gstack/controllers/__init__.py b/gstack/controllers/__init__.py
index 6e7dd61..b4fa9bd 100644
--- a/gstack/controllers/__init__.py
+++ b/gstack/controllers/__init__.py
@@ -26,7 +26,8 @@ from gstack import helpers
 from gstack.services import requester
 from gstack.controllers import errors
 
-__all__ = [os.path.basename(f)[:-3] for f in 
glob.glob(os.path.dirname(__file__) + '/*.py')]
+__all__ = [os.path.basename(f)[:-3]
+           for f in glob.glob(os.path.dirname(__file__) + '/*.py')]
 
 
 def filter_by_name(data, name):
@@ -122,7 +123,8 @@ def describe_items_aggregated(authorization, args, type, 
gce_type, to_cloudstack
 
     for zone in zone_list:
         kwargs['zone'] = zone
-        zone_items = _get_requested_items(authorization, args, type, 
to_cloudstack, **kwargs)
+        zone_items = _get_requested_items(
+            authorization, args, type, to_cloudstack, **kwargs)
         items['zone/' + zone] = {}
         if zone_items:
             items['zone/' + zone][gce_type] = zone_items
@@ -133,6 +135,7 @@ def describe_items_aggregated(authorization, args, type, 
gce_type, to_cloudstack
 
 
 def describe_items(authorization, args, type, to_cloudstack, **kwargs):
-    items = _get_requested_items(authorization, args, type, to_cloudstack, 
**kwargs)
+    items = _get_requested_items(
+        authorization, args, type, to_cloudstack, **kwargs)
 
     return items

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/gstack/controllers/images.py
----------------------------------------------------------------------
diff --git a/gstack/controllers/images.py b/gstack/controllers/images.py
index 431679d..4868448 100755
--- a/gstack/controllers/images.py
+++ b/gstack/controllers/images.py
@@ -47,7 +47,8 @@ def _cloudstack_template_to_gce(cloudstack_response):
     response['name'] = cloudstack_response['name']
     response['description'] = cloudstack_response['displaytext']
     response['status'] = cloudstack_response['isready']
-    response['selfLink'] = urllib.unquote_plus(request.base_url) + '/' + 
response['name']
+    response['selfLink'] = urllib.unquote_plus(
+        request.base_url) + '/' + response['name']
 
     return response
 

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/gstack/controllers/index.py
----------------------------------------------------------------------
diff --git a/gstack/controllers/index.py b/gstack/controllers/index.py
index 1250bdf..9927292 100755
--- a/gstack/controllers/index.py
+++ b/gstack/controllers/index.py
@@ -28,7 +28,8 @@ def discovery():
     with open(app.config['DATA'] + '/v1.json') as template:
         discovery_template = json.loads(template.read())
 
-    discovery_template['baseUrl'] = helpers.get_root_url() + '/' + 
app.config['PATH']
+    discovery_template[
+        'baseUrl'] = helpers.get_root_url() + '/' + app.config['PATH']
     discovery_template['basePath'] = '/' + app.config['PATH']
     discovery_template['rootUrl'] = helpers.get_root_url() + '/'
     discovery_template['servicePath'] = app.config['PATH']

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/gstack/controllers/instances.py
----------------------------------------------------------------------
diff --git a/gstack/controllers/instances.py b/gstack/controllers/instances.py
index 4694b14..2d3de2f 100755
--- a/gstack/controllers/instances.py
+++ b/gstack/controllers/instances.py
@@ -155,7 +155,8 @@ def listinstances(authorization, projectid, zone):
 
@app.route('/compute/v1/projects/<projectid>/zones/<zone>/instances/<instance>',
 methods=['GET'])
 @authentication.required
 def getinstance(projectid, authorization, zone, instance):
-    func_route = url_for('getinstance', projectid=projectid, zone=zone, 
instance=instance)
+    func_route = url_for(
+        'getinstance', projectid=projectid, zone=zone, instance=instance)
     args = {'command': 'listVirtualMachines'}
     kwargs = {'projectid': projectid, 'zone': zone}
     return controllers.get_item_with_name_or_error(
@@ -170,7 +171,8 @@ def addinstance(authorization, projectid, zone):
     args = {}
     args['name'] = data['name']
     args['serviceoffering'] = data['machineType'].rsplit('/', 1)[1]
-    args['template'] = 
data['disks'][0]['initializeParams']['sourceImage'].rsplit('/', 1)[1]
+    args['template'] = data['disks'][0][
+        'initializeParams']['sourceImage'].rsplit('/', 1)[1]
     args['zone'] = zone
 
     network = data['networkInterfaces'][0]['network'].rsplit('/', 1)[1]
@@ -186,7 +188,8 @@ def addinstance(authorization, projectid, zone):
     else:
         return helpers.create_response(operations.create_async_response(
             projectid=projectid,
-            
operationid=deployment_result['deployvirtualmachineresponse']['jobid'],
+            operationid=deployment_result[
+                'deployvirtualmachineresponse']['jobid'],
             authorization=authorization
         ))
 
@@ -195,7 +198,8 @@ def addinstance(authorization, projectid, zone):
 @authentication.required
 def deleteinstance(projectid, authorization, zone, instance):
     args = {'command': 'listVirtualMachines'}
-    virtual_machine = controllers.get_item_with_name(authorization, instance, 
args, 'virtualmachine')
+    virtual_machine = controllers.get_item_with_name(
+        authorization, instance, args, 'virtualmachine')
 
     virtual_machine_id = virtual_machine['id']
     args = {'id': virtual_machine_id}

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/gstack/controllers/machine_type.py
----------------------------------------------------------------------
diff --git a/gstack/controllers/machine_type.py 
b/gstack/controllers/machine_type.py
index d6e23ef..ff32af6 100755
--- a/gstack/controllers/machine_type.py
+++ b/gstack/controllers/machine_type.py
@@ -93,7 +93,8 @@ def listmachinetype(projectid, authorization, zone):
 
@app.route('/compute/v1/projects/<projectid>/zones/<zone>/machineTypes/<machinetype>',
 methods=['GET'])
 @authentication.required
 def getmachinetype(projectid, authorization, zone, machinetype):
-    func_route = url_for('getmachinetype', projectid=projectid, zone=zone, 
machinetype=machinetype)
+    func_route = url_for(
+        'getmachinetype', projectid=projectid, zone=zone, 
machinetype=machinetype)
     args = {'command': 'listServiceOfferings'}
     kwargs = {'projectid': projectid, 'zone': zone}
     return controllers.get_item_with_name_or_error(

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/gstack/controllers/networks.py
----------------------------------------------------------------------
diff --git a/gstack/controllers/networks.py b/gstack/controllers/networks.py
index e4421f1..e83f02d 100644
--- a/gstack/controllers/networks.py
+++ b/gstack/controllers/networks.py
@@ -46,7 +46,8 @@ def _add_network(authorization, args=None):
 
 def _delete_network(authorization, projectid, network):
     args = {'command': 'listSecurityGroups'}
-    network_response = controllers.get_item_with_name(authorization, network, 
args, 'securitygroup')
+    network_response = controllers.get_item_with_name(
+        authorization, network, args, 'securitygroup')
     if not network_response:
         return None
 
@@ -70,7 +71,8 @@ def _cloudstack_network_to_gce(cloudstack_response):
     response['id'] = cloudstack_response['id']
     response['name'] = cloudstack_response['name']
     response['description'] = cloudstack_response['description']
-    response['selfLink'] = urllib.unquote_plus(request.base_url) + '/' + 
response['name']
+    response['selfLink'] = urllib.unquote_plus(
+        request.base_url) + '/' + response['name']
 
     return response
 

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/gstack/controllers/operations.py
----------------------------------------------------------------------
diff --git a/gstack/controllers/operations.py b/gstack/controllers/operations.py
index d29da54..039b1db 100644
--- a/gstack/controllers/operations.py
+++ b/gstack/controllers/operations.py
@@ -78,12 +78,14 @@ def _get_instance_async_response(async_result, projectid, 
type):
 
 
 def _delete_instance_response(async_result, projectid):
-    populated_response = _get_instance_async_response(async_result, projectid, 
'delete')
+    populated_response = _get_instance_async_response(
+        async_result, projectid, 'delete')
     return populated_response
 
 
 def _create_instance_response(async_result, projectid, authorization):
-    populated_response = _get_instance_async_response(async_result, projectid, 
'insert')
+    populated_response = _get_instance_async_response(
+        async_result, projectid, 'insert')
     populated_response['user'] = async_result['userid']
 
     if async_result['jobstatus'] is 1:

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/gstack/oauth2provider.py
----------------------------------------------------------------------
diff --git a/gstack/oauth2provider.py b/gstack/oauth2provider.py
index 0c4a980..7d847f5 100644
--- a/gstack/oauth2provider.py
+++ b/gstack/oauth2provider.py
@@ -92,7 +92,8 @@ class CloudstackAuthorizationProvider(AuthorizationProvider):
             else:
                 db.session.add(
                     AccessToken(
-                        access_token, client_id, expires_in, id_token, 
json.dumps(data)
+                        access_token, client_id, expires_in, id_token, 
json.dumps(
+                            data)
                     )
                 )
 

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/migrations/env.py
----------------------------------------------------------------------
diff --git a/migrations/env.py b/migrations/env.py
index cab0b22..d65daa3 100644
--- a/migrations/env.py
+++ b/migrations/env.py
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
+
 from __future__ import with_statement
 from alembic import context
 from sqlalchemy import engine_from_config, pool
@@ -46,6 +67,7 @@ def run_migrations_offline():
     with context.begin_transaction():
         context.run_migrations()
 
+
 def run_migrations_online():
     """Run migrations in 'online' mode.
 
@@ -54,15 +76,15 @@ def run_migrations_online():
 
     """
     engine = engine_from_config(
-                config.get_section(config.config_ini_section),
-                prefix='sqlalchemy.',
-                poolclass=pool.NullPool)
+        config.get_section(config.config_ini_section),
+        prefix='sqlalchemy.',
+        poolclass=pool.NullPool)
 
     connection = engine.connect()
     context.configure(
-                connection=connection,
-                target_metadata=db.metadata
-                )
+        connection=connection,
+        target_metadata=db.metadata
+    )
 
     try:
         with context.begin_transaction():
@@ -74,4 +96,3 @@ if context.is_offline_mode():
     run_migrations_offline()
 else:
     run_migrations_online()
-

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/migrations/versions/25c3e5241cd0_.py
----------------------------------------------------------------------
diff --git a/migrations/versions/25c3e5241cd0_.py 
b/migrations/versions/25c3e5241cd0_.py
index b330147..a7ef8a6 100644
--- a/migrations/versions/25c3e5241cd0_.py
+++ b/migrations/versions/25c3e5241cd0_.py
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
+
 """empty message
 
 Revision ID: 25c3e5241cd0
@@ -16,20 +37,21 @@ import sqlalchemy as sa
 
 def upgrade():
     op.add_column('accesstoken',
-        sa.Column(
-            'id_token',
-            sa.String(length=1000),
-            nullable=True
-        )
-    )
+                  sa.Column(
+                      'id_token',
+                      sa.String(length=1000),
+                      nullable=True
+                  )
+                  )
 
     op.add_column('refreshtoken',
-        sa.Column(
-            'id_token',
-            sa.String(length=1000),
-            nullable=True
-        )
-    )
+                  sa.Column(
+                      'id_token',
+                      sa.String(length=1000),
+                      nullable=True
+                  )
+                  )
+
 
 def downgrade():
     pass

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/migrations/versions/76bb287a37d_.py
----------------------------------------------------------------------
diff --git a/migrations/versions/76bb287a37d_.py 
b/migrations/versions/76bb287a37d_.py
index efc9887..175fd3e 100644
--- a/migrations/versions/76bb287a37d_.py
+++ b/migrations/versions/76bb287a37d_.py
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
+
 """empty message
 
 Revision ID: 76bb287a37d
@@ -16,53 +37,53 @@ import sqlalchemy as sa
 
 def upgrade():
     op.create_table('accesstoken',
-        sa.Column(
-            'access_token',
-            sa.String(length=255),
-            nullable=False),
-        sa.Column(
-            'client_id',
-            sa.String(length=255),
-            nullable=True),
-        sa.Column(
-            'expires_in',
-            sa.String(length=10),
-            nullable=True),
-        sa.Column(
-            'data',
-            sa.String(length=500),
-            nullable=True),
-        sa.PrimaryKeyConstraint('access_token'),
-        sa.UniqueConstraint('client_id')
-    )
+                    sa.Column(
+                        'access_token',
+                        sa.String(length=255),
+                        nullable=False),
+                    sa.Column(
+                        'client_id',
+                        sa.String(length=255),
+                        nullable=True),
+                    sa.Column(
+                        'expires_in',
+                        sa.String(length=10),
+                        nullable=True),
+                    sa.Column(
+                        'data',
+                        sa.String(length=500),
+                        nullable=True),
+                    sa.PrimaryKeyConstraint('access_token'),
+                    sa.UniqueConstraint('client_id')
+                    )
     op.create_table('client',
-        sa.Column('client_id',
-            sa.String(length=255),
-            nullable=False),
-        sa.Column(
-            'client_secret',
-            sa.String(length=255),
-            nullable=True),
-        sa.PrimaryKeyConstraint('client_id'),
-        sa.UniqueConstraint('client_secret')
-    )
+                    sa.Column('client_id',
+                              sa.String(length=255),
+                              nullable=False),
+                    sa.Column(
+                        'client_secret',
+                        sa.String(length=255),
+                        nullable=True),
+                    sa.PrimaryKeyConstraint('client_id'),
+                    sa.UniqueConstraint('client_secret')
+                    )
     op.create_table('refreshtoken',
-        sa.Column(
-            'refresh_token',
-            sa.String(length=255),
-            nullable=False),
-        sa.Column(
-            'client_id',
-            sa.String(length=255),
-            nullable=True),
-        sa.Column(
-            'data',
-            sa.String(length=500),
-            nullable=True),
-        sa.PrimaryKeyConstraint('refresh_token'),
-        sa.UniqueConstraint('client_id')
-    )
+                    sa.Column(
+                        'refresh_token',
+                        sa.String(length=255),
+                        nullable=False),
+                    sa.Column(
+                        'client_id',
+                        sa.String(length=255),
+                        nullable=True),
+                    sa.Column(
+                        'data',
+                        sa.String(length=500),
+                        nullable=True),
+                    sa.PrimaryKeyConstraint('refresh_token'),
+                    sa.UniqueConstraint('client_id')
+                    )
 
 
 def downgrade():
-    pass
\ No newline at end of file
+    pass

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/pyoauth2/__init__.py
----------------------------------------------------------------------
diff --git a/pyoauth2/__init__.py b/pyoauth2/__init__.py
index e69de29..0e3241d 100644
--- a/pyoauth2/__init__.py
+++ b/pyoauth2/__init__.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/pyoauth2/client.py
----------------------------------------------------------------------
diff --git a/pyoauth2/client.py b/pyoauth2/client.py
index 55d357c..4f5f777 100644
--- a/pyoauth2/client.py
+++ b/pyoauth2/client.py
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
+
 import requests
 from . import utils
 

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/pyoauth2/provider.py
----------------------------------------------------------------------
diff --git a/pyoauth2/provider.py b/pyoauth2/provider.py
index f939887..e0a2ca4 100644
--- a/pyoauth2/provider.py
+++ b/pyoauth2/provider.py
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
+
 import json
 import jwt
 from requests import Response
@@ -9,6 +30,7 @@ except ImportError:
 from . import utils
 from gstack import app
 
+
 class Provider(object):
 
     """Base provider class for different types of OAuth 2.0 providers."""
@@ -132,8 +154,7 @@ class AuthorizationProvider(Provider):
 
         :rtype: str
         """
-        return  jwt.encode({"email": "user@gstack"}, client_secret)
-
+        return jwt.encode({"email": "user@gstack"}, client_secret)
 
     def generate_authorization_code(self):
         """Generate a random authorization code.

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/pyoauth2/tests/__init__.py
----------------------------------------------------------------------
diff --git a/pyoauth2/tests/__init__.py b/pyoauth2/tests/__init__.py
index e69de29..0e3241d 100644
--- a/pyoauth2/tests/__init__.py
+++ b/pyoauth2/tests/__init__.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/pyoauth2/tests/test_client.py
----------------------------------------------------------------------
diff --git a/pyoauth2/tests/test_client.py b/pyoauth2/tests/test_client.py
index d06f02c..5669959 100644
--- a/pyoauth2/tests/test_client.py
+++ b/pyoauth2/tests/test_client.py
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
+
 from __future__ import absolute_import
 import unittest
 from pyoauth2.client import Client

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/pyoauth2/tests/test_integration.py
----------------------------------------------------------------------
diff --git a/pyoauth2/tests/test_integration.py 
b/pyoauth2/tests/test_integration.py
index e164304..819e7c5 100644
--- a/pyoauth2/tests/test_integration.py
+++ b/pyoauth2/tests/test_integration.py
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
+
 from __future__ import absolute_import
 import unittest
 from pyoauth2.provider import AuthorizationProvider

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/pyoauth2/tests/test_provider.py
----------------------------------------------------------------------
diff --git a/pyoauth2/tests/test_provider.py b/pyoauth2/tests/test_provider.py
index 565322c..9c08531 100644
--- a/pyoauth2/tests/test_provider.py
+++ b/pyoauth2/tests/test_provider.py
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
+
 from __future__ import absolute_import
 import unittest
 from pyoauth2.provider import AuthorizationProvider

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/pyoauth2/tests/test_utils.py
----------------------------------------------------------------------
diff --git a/pyoauth2/tests/test_utils.py b/pyoauth2/tests/test_utils.py
index 3b2b8ad..42c7e31 100644
--- a/pyoauth2/tests/test_utils.py
+++ b/pyoauth2/tests/test_utils.py
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
+
 from __future__ import absolute_import
 import unittest
 from pyoauth2 import utils

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/pyoauth2/utils.py
----------------------------------------------------------------------
diff --git a/pyoauth2/utils.py b/pyoauth2/utils.py
index fad4291..35156bf 100644
--- a/pyoauth2/utils.py
+++ b/pyoauth2/utils.py
@@ -1,3 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
+
 import string
 import urllib
 import urlparse

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index d96978d..7e04cab 100755
--- a/setup.py
+++ b/setup.py
@@ -16,6 +16,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
+import os
+
 try:
     from setuptools import setup
 except ImportError:
@@ -29,8 +31,6 @@ except ImportError:
 
 VERSION = '1.1.1'
 
-import os
-
 
 def read(fname):
     return open(os.path.join(os.path.dirname(__file__), fname)).read().strip()

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/tests/__init__.py
----------------------------------------------------------------------
diff --git a/tests/__init__.py b/tests/__init__.py
index 6308895..168c654 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,5 +1,23 @@
 #!/usr/bin/env python
 # encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
 
 from unittest import TestCase
 
@@ -12,9 +30,11 @@ from . import settings
 from gstack.core import db
 from .utils import FlaskTestCaseMixin
 
+
 class GStackTestCase(TestCase):
     pass
 
+
 class GStackAppTestCase(FlaskTestCaseMixin, GStackTestCase):
 
     access_token = ""
@@ -23,16 +43,17 @@ class GStackAppTestCase(FlaskTestCaseMixin, GStackTestCase):
         configure_app(settings=settings)
 
     def _unauthed_user(self):
-        response = 
self.get('/compute/v1/projects/exampleproject/global/images')
+        response = self.get(
+            '/compute/v1/projects/exampleproject/global/images')
         self.assert_unauthorized(response)
 
-
     def _auth_example_user(self):
         data = {}
         data['code'] = 'hjrZryvgLYo3R833NkHHV8jYmxQhsD8TjKWzOm2f'
         data['grant_type'] = 'authorization_code'
         data['client_id'] = 'ExampleAPIKey'
-        data['client_secret'] = 
'eXmaPlEm8XQwezvLOd10Qt3wXH7j9mRgaKbEg3nRDnj7FtlF3yx54EWd9mR5sB1ec5LQDV6gjpy6sfDo6ndUeeww'
+        data[
+            'client_secret'] = 
'eXmaPlEm8XQwezvLOd10Qt3wXH7j9mRgaKbEg3nRDnj7FtlF3yx54EWd9mR5sB1ec5LQDV6gjpy6sfDo6ndUeeww'
         data['redirect_uri'] = 'http://localhost:8000'
 
         get = mock.Mock()
@@ -40,15 +61,15 @@ class GStackAppTestCase(FlaskTestCaseMixin, GStackTestCase):
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            
self.get('/oauth2/auth?scope=example&redirect_uri=http://127.0.0.1:9999&response_type=code&client_id=ExampleAPIKey&access_type=offline')
+            self.get(
+                
'/oauth2/auth?scope=example&redirect_uri=http://127.0.0.1:9999&response_type=code&client_id=ExampleAPIKey&access_type=offline')
             response = self.post_html('/oauth2/token', data=data)
 
-        GStackAppTestCase.access_token = 
json.loads(response.data)['access_token']
+        GStackAppTestCase.access_token = json.loads(
+            response.data)['access_token']
 
         self.assert_ok(response)
 
-
-
     def setUp(self):
         super(GStackTestCase, self).setUp()
         self._configure_app()
@@ -60,7 +81,6 @@ class GStackAppTestCase(FlaskTestCaseMixin, GStackTestCase):
         self._unauthed_user()
         self._auth_example_user()
 
-
     def tearDown(self):
         super(GStackTestCase, self).tearDown()
         db.drop_all()

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/tests/discovery_tests.py
----------------------------------------------------------------------
diff --git a/tests/discovery_tests.py b/tests/discovery_tests.py
index a35724d..d634c26 100644
--- a/tests/discovery_tests.py
+++ b/tests/discovery_tests.py
@@ -1,11 +1,30 @@
 #!/usr/bin/env python
 # encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
 
 from . import GStackAppTestCase
 
+
 class DiscoveryTestCase(GStackAppTestCase):
 
     def test_discovery(self):
         response = self.get('/discovery/v1/apis/compute/v1/rest')
 
-        self.assert_ok(response)
\ No newline at end of file
+        self.assert_ok(response)

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/tests/disks_tests.py
----------------------------------------------------------------------
diff --git a/tests/disks_tests.py b/tests/disks_tests.py
index f9635a3..5558276 100644
--- a/tests/disks_tests.py
+++ b/tests/disks_tests.py
@@ -1,5 +1,23 @@
 #!/usr/bin/env python
 # encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
 
 import mock
 import json
@@ -7,29 +25,35 @@ import json
 from gstack.helpers import read_file
 from . import GStackAppTestCase
 
+
 class DisksTestCase(GStackAppTestCase):
 
     def test_list_disks(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_volumes.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_volumes.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/zones/examplezone/disks', 
headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                '/compute/v1/projects/exampleproject/zones/examplezone/disks', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_list_disks_with_name_filter(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_volumes.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_volumes.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
 
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
             response = self.get(
                 
'/compute/v1/projects/projectid/zones/zonename/disks?filter=name+eq+volumename',
                 headers=headers)
@@ -39,37 +63,44 @@ class DisksTestCase(GStackAppTestCase):
     def test_aggregated_list_disks(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_volumes.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_volumes.json')
         get.return_value.status_code = 200
 
         get_zones = mock.Mock()
-        get_zones.return_value = 
json.loads(read_file('tests/data/valid_describe_zone.json'))
+        get_zones.return_value = json.loads(
+            read_file('tests/data/valid_describe_zone.json'))
 
         with mock.patch('requests.get', get):
             with mock.patch(
                 'gstack.controllers.zones._get_zones',
                 get_zones
             ):
-                headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-                response = 
self.get('/compute/v1/projects/projectid/aggregated/disks', headers=headers)
+                headers = {
+                    'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+                response = self.get(
+                    '/compute/v1/projects/projectid/aggregated/disks', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_aggregated_list_disks_with_name_filter(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_volume.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_volume.json')
         get.return_value.status_code = 200
 
         get_zones = mock.Mock()
-        get_zones.return_value = 
json.loads(read_file('tests/data/valid_describe_zone.json'))
+        get_zones.return_value = json.loads(
+            read_file('tests/data/valid_describe_zone.json'))
 
         with mock.patch('requests.get', get):
             with mock.patch(
                 'gstack.controllers.zones._get_zones',
                 get_zones
             ):
-                headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+                headers = {
+                    'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
                 response = self.get(
                     
'/compute/v1/projects/projectid/aggregated/disks?filter=name+eq+volumename',
                     headers=headers)
@@ -79,27 +110,32 @@ class DisksTestCase(GStackAppTestCase):
     def test_get_disk(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_volume.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_volume.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/zones/examplezone/disks/volumename',
 headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/zones/examplezone/disks/volumename', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_get_disk_disk_not_found(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/empty_describe_volumes.json')
+        get.return_value.text = read_file(
+            'tests/data/empty_describe_volumes.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/zones/examplezone/disks/volumename',
 headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/zones/examplezone/disks/volumename', 
headers=headers)
 
         self.assert_not_found(response)
 
         assert 'The resource 
\'/compute/v1/projects/exampleproject/zones/examplezone/disks/volumename\' was 
not found' \
-                in response.data
-
+            in response.data

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/tests/firewalls_tests.py
----------------------------------------------------------------------
diff --git a/tests/firewalls_tests.py b/tests/firewalls_tests.py
index 33cec1e..af6cca1 100644
--- a/tests/firewalls_tests.py
+++ b/tests/firewalls_tests.py
@@ -1,52 +1,78 @@
 #!/usr/bin/env python
 # encoding: utf-8
-
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
 import mock
 import json
 
 from gstack.helpers import read_file
 from . import GStackAppTestCase
 
+
 class FirewallsTestCase(GStackAppTestCase):
 
     def test_list_firewalls(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_security_groups.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_security_groups.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/global/firewalls', 
headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                '/compute/v1/projects/exampleproject/global/firewalls', 
headers=headers)
 
         self.assert_ok(response)
 
-
     def test_get_firewall(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_security_group.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_security_group.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/global/firewalls/securitygroupname',
 headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/global/firewalls/securitygroupname', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_get_firewall_firewall_not_found(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/empty_describe_security_groups.json')
+        get.return_value.text = read_file(
+            'tests/data/empty_describe_security_groups.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/global/firewalls/securitygroupname',
 headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/global/firewalls/securitygroupname', 
headers=headers)
 
         self.assert_not_found(response)
         assert 'The resource 
\'/compute/v1/projects/exampleproject/global/firewalls/securitygroupname\' was 
not found' \
-                in response.data
+            in response.data
 
     def test_add_firewall(self):
         data = {
@@ -64,29 +90,33 @@ class FirewallsTestCase(GStackAppTestCase):
         data = json.dumps(data)
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_create_security_group.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_create_security_group.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-             headers = {
-                 'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
-             }
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
+            }
 
-             response = 
self.post_json('/compute/v1/projects/exampleproject/global/firewalls', 
data=data, headers=headers)
+            response = self.post_json(
+                '/compute/v1/projects/exampleproject/global/firewalls', 
data=data, headers=headers)
 
         self.assert_ok(response)
 
     def test_delete_firewall(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_delete_security_group.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_delete_security_group.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-             headers = {
-                 'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
-             }
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
+            }
 
-             response = 
self.delete('/compute/v1/projects/exampleproject/global/firewalls/firewallname',
 headers=headers)
+            response = self.delete(
+                
'/compute/v1/projects/exampleproject/global/firewalls/firewallname', 
headers=headers)
 
         self.assert_ok(response)

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/tests/images_tests.py
----------------------------------------------------------------------
diff --git a/tests/images_tests.py b/tests/images_tests.py
index 8a9f2c0..d306366 100644
--- a/tests/images_tests.py
+++ b/tests/images_tests.py
@@ -1,47 +1,75 @@
 #!/usr/bin/env python
 # encoding: utf-8
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
 
 import mock
 
 from gstack.helpers import read_file
 from . import GStackAppTestCase
 
+
 class ImagesTestCase(GStackAppTestCase):
 
     def test_list_images(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_images.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_images.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/global/images', headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                '/compute/v1/projects/exampleproject/global/images', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_get_image(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_images.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_images.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/global/images/imagename', 
headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                '/compute/v1/projects/exampleproject/global/images/imagename', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_get_image_image_not_found(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/empty_describe_images.json')
+        get.return_value.text = read_file(
+            'tests/data/empty_describe_images.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/global/images/imagename', 
headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                '/compute/v1/projects/exampleproject/global/images/imagename', 
headers=headers)
 
         self.assert_not_found(response)
         assert 'The resource 
\'/compute/v1/projects/exampleproject/global/images/imagename\' was not found' \
-                in response.data
+            in response.data

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/tests/instances_tests.py
----------------------------------------------------------------------
diff --git a/tests/instances_tests.py b/tests/instances_tests.py
index 6f548ae..816bf4a 100644
--- a/tests/instances_tests.py
+++ b/tests/instances_tests.py
@@ -1,6 +1,23 @@
 #!/usr/bin/env python
 # encoding: utf-8
-
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
 import mock
 import json
 from gstack import publickey_storage
@@ -8,44 +25,54 @@ from gstack import publickey_storage
 from gstack.helpers import read_file
 from . import GStackAppTestCase
 
+
 class InstancesTestCase(GStackAppTestCase):
 
     def test_list_instances(self):
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_instances.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_instances.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/zones/examplezone/instances', 
headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/zones/examplezone/instances', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_aggregated_list_instances(self):
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_instances.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_instances.json')
         get.return_value.status_code = 200
 
         get_zones = mock.Mock()
-        get_zones.return_value = 
json.loads(read_file('tests/data/valid_describe_zone.json'))
+        get_zones.return_value = json.loads(
+            read_file('tests/data/valid_describe_zone.json'))
 
         with mock.patch('requests.get', get):
             with mock.patch(
                 'gstack.controllers.zones._get_zones',
                 get_zones
             ):
-                headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-                response = 
self.get('/compute/v1/projects/projectid/aggregated/instances', headers=headers)
+                headers = {
+                    'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+                response = self.get(
+                    '/compute/v1/projects/projectid/aggregated/instances', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_list_instances_with_name_filter(self):
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_instance.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_instance.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
             response = self.get(
                 
'/compute/v1/projects/projectid/zones/zonename/instances?filter=name+eq+instancename',
                 headers=headers)
@@ -54,18 +81,21 @@ class InstancesTestCase(GStackAppTestCase):
 
     def test_aggregated_list_instances_with_name_filter(self):
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_instance.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_instance.json')
         get.return_value.status_code = 200
 
         get_zones = mock.Mock()
-        get_zones.return_value = 
json.loads(read_file('tests/data/valid_describe_zone.json'))
+        get_zones.return_value = json.loads(
+            read_file('tests/data/valid_describe_zone.json'))
 
         with mock.patch('requests.get', get):
             with mock.patch(
                 'gstack.controllers.zones._get_zones',
                 get_zones
             ):
-                headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+                headers = {
+                    'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
                 response = self.get(
                     
'/compute/v1/projects/projectid/aggregated/instances?filter=name+eq+instancename',
                     headers=headers)
@@ -74,86 +104,97 @@ class InstancesTestCase(GStackAppTestCase):
 
     def test_get_instance(self):
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_instance.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_instance.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/zones/examplezone/instances/instancename',
 headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/zones/examplezone/instances/instancename', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_get_instance_instance_not_found(self):
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/empty_describe_instances.json')
+        get.return_value.text = read_file(
+            'tests/data/empty_describe_instances.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/zones/examplezone/instances/instancename',
 headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/zones/examplezone/instances/instancename', 
headers=headers)
 
         self.assert_not_found(response)
         assert 'The resource 
\'/compute/v1/projects/exampleproject/zones/examplezone/instances/instancename\'
 was not found' \
-                in response.data
+            in response.data
 
     def test_delete_instance(self):
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_async_destroy_vm.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_async_destroy_vm.json')
         get.return_value.status_code = 200
 
         get_instance = mock.Mock()
-        get_instance.return_value = 
json.loads(read_file('tests/data/valid_get_instance.json'))
+        get_instance.return_value = json.loads(
+            read_file('tests/data/valid_get_instance.json'))
 
         get_async_result = mock.Mock()
-        get_async_result.return_value = 
json.loads(read_file('tests/data/valid_run_instance.json'))
+        get_async_result.return_value = json.loads(
+            read_file('tests/data/valid_run_instance.json'))
 
         publickey_storage['admin'] = 'testkey'
 
         with mock.patch('requests.get', get):
             with mock.patch(
-                    'gstack.controllers.get_item_with_name',
-                    get_instance
-                ):
+                'gstack.controllers.get_item_with_name',
+                get_instance
+            ):
                 with mock.patch(
                     'gstack.controllers.operations._get_async_result',
                     get_async_result
                 ):
-                    headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-                    response = 
self.delete('/compute/v1/projects/admin/zones/examplezone/instances/instancename',
 headers=headers)
+                    headers = {
+                        'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+                    response = self.delete(
+                        
'/compute/v1/projects/admin/zones/examplezone/instances/instancename', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_add_instance(self):
         data = {
-             'kind':  'compte#instance',
-             'machineType':  
'https://localhost:5000/compte/v1/projects/brogan...@darrenbrogan.ie/zones/ch-gva-2/machineTypes/machinetypename',
-             'description':  '',
-             'tags': {
-                 'items': []
-             },
-             'disks': [{
-                 'deviceName':  'machinetypename',
-                 'initializeParams': {
-                     'diskName':  'machinetypename',
-                     'sourceImage':  
'https://localhost:5000/compte/v1/projects/brogan...@darrenbrogan.ie/global/images/imagename'
-                 },
-                 'autoDelete': False,
-                 'boot': True,
-                 'mode':  'READ_WRITE',
-                 'type':  'PERSISTENT'
-             }],
-             'metadata': {
-                 'items': [],
-                 'kind':  'compte#metadata'
-             },
-             'networkInterfaces': [{
-                 'accessConfigs': [{
-                     'type':  'ONE_TO_ONE_NAT',
-                     'name':  'External NAT'
-                 }],
-                 'network':  
'https://localhost:5000/compte/v1/projects/brogan...@darrenbrogan.ie/global/networks/networkname'
-             }],
-             'name':  'foobar'
+            'kind':  'compte#instance',
+            'machineType':  
'https://localhost:5000/compte/v1/projects/brogan...@darrenbrogan.ie/zones/ch-gva-2/machineTypes/machinetypename',
+            'description':  '',
+            'tags': {
+                'items': []
+            },
+            'disks': [{
+                'deviceName':  'machinetypename',
+                'initializeParams': {
+                    'diskName':  'machinetypename',
+                    'sourceImage':  
'https://localhost:5000/compte/v1/projects/brogan...@darrenbrogan.ie/global/images/imagename'
+                },
+                'autoDelete': False,
+                'boot': True,
+                'mode':  'READ_WRITE',
+                'type':  'PERSISTENT'
+            }],
+            'metadata': {
+                'items': [],
+                'kind':  'compte#metadata'
+            },
+            'networkInterfaces': [{
+                'accessConfigs': [{
+                    'type':  'ONE_TO_ONE_NAT',
+                    'name':  'External NAT'
+                }],
+                'network':  
'https://localhost:5000/compte/v1/projects/brogan...@darrenbrogan.ie/global/networks/networkname'
+            }],
+            'name':  'foobar'
         }
 
         publickey_storage['admin'] = 'testkey'
@@ -161,23 +202,29 @@ class InstancesTestCase(GStackAppTestCase):
         data = json.dumps(data)
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_async_deploy_vm.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_async_deploy_vm.json')
         get.return_value.status_code = 200
 
         get_templates = mock.Mock()
-        get_templates.return_value = 
json.loads(read_file('tests/data/valid_get_image.json'))
+        get_templates.return_value = json.loads(
+            read_file('tests/data/valid_get_image.json'))
 
         get_zones = mock.Mock()
-        get_zones.return_value = 
json.loads(read_file('tests/data/valid_get_zone.json'))
+        get_zones.return_value = json.loads(
+            read_file('tests/data/valid_get_zone.json'))
 
         get_service_offerings = mock.Mock()
-        get_service_offerings.return_value = 
json.loads(read_file('tests/data/valid_get_service_offering.json'))
+        get_service_offerings.return_value = json.loads(
+            read_file('tests/data/valid_get_service_offering.json'))
 
         get_networks = mock.Mock()
-        get_networks.return_value = 
json.loads(read_file('tests/data/valid_get_security_group.json'))
+        get_networks.return_value = json.loads(
+            read_file('tests/data/valid_get_security_group.json'))
 
         get_async_result = mock.Mock()
-        get_async_result.return_value = 
json.loads(read_file('tests/data/valid_run_instance.json'))
+        get_async_result.return_value = json.loads(
+            read_file('tests/data/valid_run_instance.json'))
 
         with mock.patch('requests.get', get):
             with mock.patch(
@@ -188,13 +235,13 @@ class InstancesTestCase(GStackAppTestCase):
                     'gstack.controllers.zones.get_zone_by_name',
                     get_zones
                 ):
-                     with mock.patch(
-                        
'gstack.controllers.machine_type.get_machinetype_by_name',
-                        get_service_offerings
+                    with mock.patch(
+                            
'gstack.controllers.machine_type.get_machinetype_by_name',
+                            get_service_offerings
                     ):
-                         with mock.patch(
-                            'gstack.controllers.networks.get_network_by_name',
-                            get_networks
+                        with mock.patch(
+                                
'gstack.controllers.networks.get_network_by_name',
+                                get_networks
                         ):
                             with mock.patch(
                                 
'gstack.controllers.operations._get_async_result',
@@ -204,6 +251,7 @@ class InstancesTestCase(GStackAppTestCase):
                                     'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
                                 }
 
-                                response = 
self.post_json('/compute/v1/projects/admin/zones/zonename/instances', 
data=data, headers=headers)
+                                response = self.post_json(
+                                    
'/compute/v1/projects/admin/zones/zonename/instances', data=data, 
headers=headers)
 
         self.assert_ok(response)

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/tests/machine_type_tests.py
----------------------------------------------------------------------
diff --git a/tests/machine_type_tests.py b/tests/machine_type_tests.py
index f6e882d..bf4d0b0 100644
--- a/tests/machine_type_tests.py
+++ b/tests/machine_type_tests.py
@@ -1,83 +1,114 @@
 #!/usr/bin/env python
 # encoding: utf-8
-
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
 import mock
 import json
 
 from gstack.helpers import read_file
 from . import GStackAppTestCase
 
+
 class MachineTypesTestCase(GStackAppTestCase):
 
     def test_list_machine_types(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_service_offerings.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_service_offerings.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/zones/examplezone/machineTypes', 
headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/zones/examplezone/machineTypes', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_aggregated_list_machine_types(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_service_offerings.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_service_offerings.json')
         get.return_value.status_code = 200
 
         get_zones = mock.Mock()
-        get_zones.return_value = 
json.loads(read_file('tests/data/valid_describe_zone.json'))
+        get_zones.return_value = json.loads(
+            read_file('tests/data/valid_describe_zone.json'))
 
         with mock.patch('requests.get', get):
             with mock.patch(
                 'gstack.controllers.zones._get_zones',
                 get_zones
             ):
-                headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-                response = 
self.get('/compute/v1/projects/projectid/aggregated/machineTypes', 
headers=headers)
+                headers = {
+                    'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+                response = self.get(
+                    '/compute/v1/projects/projectid/aggregated/machineTypes', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_list_machine_types_with_name_filter(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_service_offering.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_service_offering.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
             response = self.get(
                 
'/compute/v1/projects/projectid/zones/zonename/machineTypes?filter=name+eq+machinetypename',
                 headers=headers)
 
         self.assert_ok(response)
 
-
     def test_get_machine_type(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_service_offering.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_service_offering.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/zones/examplezone/machineTypes/machinetypename',
 headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/zones/examplezone/machineTypes/machinetypename',
 headers=headers)
 
         self.assert_ok(response)
 
     def test_get_machine_type_machine_type_not_found(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_service_offering.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_service_offering.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/zones/examplezone/machineTypes/invalidmachinetypename',
 headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/zones/examplezone/machineTypes/invalidmachinetypename',
 headers=headers)
 
         self.assert_not_found(response)
         assert 'The resource 
\'/compute/v1/projects/exampleproject/zones/examplezone/machineTypes/invalidmachinetypename\'
 was not found' \
-                in response.data
-
+            in response.data

http://git-wip-us.apache.org/repos/asf/cloudstack-gcestack/blob/c6cda06f/tests/networks_tests.py
----------------------------------------------------------------------
diff --git a/tests/networks_tests.py b/tests/networks_tests.py
index d88aa82..f9159ca 100644
--- a/tests/networks_tests.py
+++ b/tests/networks_tests.py
@@ -1,51 +1,78 @@
 #!/usr/bin/env python
 # encoding: utf-8
-
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, 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.
+#
 import mock
 import json
 
 from gstack.helpers import read_file
 from . import GStackAppTestCase
 
+
 class NetworksTestCase(GStackAppTestCase):
 
     def test_list_networks(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_security_groups.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_security_groups.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/global/networks', headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                '/compute/v1/projects/exampleproject/global/networks', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_get_network(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_describe_security_group.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_describe_security_group.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/global/networks/networkname', 
headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/global/networks/networkname', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_get_network_network_not_found(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/empty_describe_security_groups.json')
+        get.return_value.text = read_file(
+            'tests/data/empty_describe_security_groups.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-            headers = {'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
-            response = 
self.get('/compute/v1/projects/exampleproject/global/networks/networkname', 
headers=headers)
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token)}
+            response = self.get(
+                
'/compute/v1/projects/exampleproject/global/networks/networkname', 
headers=headers)
 
         self.assert_not_found(response)
         assert 'The resource 
\'/compute/v1/projects/exampleproject/global/networks/networkname\'' \
-                in response.data
+            in response.data
 
     def test_add_network(self):
         data = {
@@ -58,15 +85,17 @@ class NetworksTestCase(GStackAppTestCase):
         data = json.dumps(data)
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_create_security_group.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_create_security_group.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-             headers = {
-                 'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
-             }
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
+            }
 
-             response = 
self.post_json('/compute/v1/projects/admin/global/networks', data=data, 
headers=headers)
+            response = self.post_json(
+                '/compute/v1/projects/admin/global/networks', data=data, 
headers=headers)
 
         self.assert_ok(response)
 
@@ -81,41 +110,47 @@ class NetworksTestCase(GStackAppTestCase):
         data = json.dumps(data)
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/duplicate_create_security_group.json')
+        get.return_value.text = read_file(
+            'tests/data/duplicate_create_security_group.json')
         get.return_value.status_code = 200
 
         with mock.patch('requests.get', get):
-             headers = {
-                 'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
-             }
+            headers = {
+                'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
+            }
 
-             response = 
self.post_json('/compute/v1/projects/admin/global/networks', data=data, 
headers=headers)
+            response = self.post_json(
+                '/compute/v1/projects/admin/global/networks', data=data, 
headers=headers)
 
         assert 'RESOURCE_ALREADY_EXISTS' in response.data
 
     def test_delete_network(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_delete_security_group.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_delete_security_group.json')
         get.return_value.status_code = 200
 
         get_networks = mock.Mock()
-        get_networks.return_value = 
json.loads(read_file('tests/data/valid_get_security_group.json'))
+        get_networks.return_value = json.loads(
+            read_file('tests/data/valid_get_security_group.json'))
 
         with mock.patch('requests.get', get):
             with mock.patch('gstack.controllers.get_item_with_name', 
get_networks):
-             headers = {
-                 'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
-             }
+                headers = {
+                    'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
+                }
 
-             response = 
self.delete('/compute/v1/projects/exampleproject/global/networks/networkname', 
headers=headers)
+                response = self.delete(
+                    
'/compute/v1/projects/exampleproject/global/networks/networkname', 
headers=headers)
 
         self.assert_ok(response)
 
     def test_delete_network_network_not_found(self):
 
         get = mock.Mock()
-        get.return_value.text = 
read_file('tests/data/valid_delete_security_group.json')
+        get.return_value.text = read_file(
+            'tests/data/valid_delete_security_group.json')
         get.return_value.status_code = 200
 
         get_networks = mock.Mock()
@@ -123,12 +158,13 @@ class NetworksTestCase(GStackAppTestCase):
 
         with mock.patch('requests.get', get):
             with mock.patch('gstack.controllers.get_item_with_name', 
get_networks):
-             headers = {
-                 'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
-             }
+                headers = {
+                    'authorization': 'Bearer ' + 
str(GStackAppTestCase.access_token),
+                }
 
-             response = 
self.delete('/compute/v1/projects/exampleproject/global/networks/invalidnetworkname',
 headers=headers)
+                response = self.delete(
+                    
'/compute/v1/projects/exampleproject/global/networks/invalidnetworkname', 
headers=headers)
 
         self.assert_not_found(response)
         assert 'The resource 
\'/compute/v1/projects/exampleproject/global/networks/invalidnetworkname\'' \
-                in response.data
+            in response.data

Reply via email to