Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various cleanups #81

Merged
merged 7 commits into from
Sep 14, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ include =
[report]
exclude_lines =
pragma: NO COVER
if __name__ == '__main__':
13 changes: 10 additions & 3 deletions appengine/images/tests/test_guestbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ def setUp(self):
reload(main)

def test_get(self):
main.Greeting(
parent=main.guestbook_key('default_guestbook'),
author='123',
content='abc'
).put()

# Build a request object passing the URI path to be tested.
# You can also pass headers, query arguments etc.
request = webapp2.Request.blank('/')
Expand All @@ -43,7 +49,7 @@ def test_post(self, mock_images):
request = webapp2.Request.blank(
'/sign',
POST={'content': 'asdf'},
)
)
response = request.get_response(main.app)
mock_images.resize.assert_called_once_with(mock.ANY, 32, 32)

Expand All @@ -53,10 +59,11 @@ def test_post(self, mock_images):
def test_img(self):
greeting = main.Greeting(
parent=main.guestbook_key('default_guestbook'),
id=123,
id=123
)
greeting.author = 'asdf'
greeting.content = 'asdf'
greeting.avatar = b'123'
greeting.put()

request = webapp2.Request.blank(
Expand All @@ -79,7 +86,7 @@ def test_post_and_get(self, mock_images):
request = webapp2.Request.blank(
'/sign',
POST={'content': 'asdf'},
)
)
response = request.get_response(main.app)

request = webapp2.Request.blank('/')
Expand Down
2 changes: 1 addition & 1 deletion appengine/localtesting/test_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def GetEntityViaMemcache(entity_key):


# [START datastore_example_test]
class DatstoreTestCase(unittest.TestCase):
class DatastoreTestCase(unittest.TestCase):

def setUp(self):
# First, create an instance of the Testbed class.
Expand Down
Empty file added blog/__init__.py
Empty file.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Introduction to data models in Cloud Datastore

This sample code is used in [this blog post](). It demonstrates two data models
using [Google Cloud Datstore](https://cloud.google.com/datastore).
using [Google Cloud Datastore](https://cloud.google.com/datastore).

## Prerequisites

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from blog import main
from tests import CloudBaseTest

from .blog import main


class BlogTestCase(CloudBaseTest):
"""Simple test case that ensures the blog code doesn't throw any errors."""
Expand Down
23 changes: 23 additions & 0 deletions blog/introduction_to_data_models_in_cloud_datastore/test_wiki.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2015, Google, Inc.
# Licensed 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 tests import CloudBaseTest

from .wiki import main


class WikiTestCase(CloudBaseTest):
"""Simple test case that ensures the wiki code doesn't throw any errors."""

def test_main(self):
main(self.constants['projectId'])
1 change: 1 addition & 0 deletions datastore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ This section contains samples for [Google Cloud Datastore](https://cloud.google.
## Other Samples

* [Google App Engine & NDB](../appengine/ndb).
* [Blog Sample: Introduction to Data Models in Cloud Datastore](../blog/introduction_to_data_models_in_cloud_datastore).
29 changes: 29 additions & 0 deletions storage/tests/test_compose_objects.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2015, Google, Inc.
# Licensed 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 os

from storage.compose_objects import main
from tests import CloudBaseTest


class TestComposeObjects(CloudBaseTest):
def test_main(self):
args = [
'ignored_command_name',
self.constants['bucketName'],
'dest.txt',
os.path.join(self.resource_path, 'file1.txt'),
os.path.join(self.resource_path, 'file2.txt'),
]
main(args)
1 change: 1 addition & 0 deletions tests/resources/file1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file1
1 change: 1 addition & 0 deletions tests/resources/file2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file2
12 changes: 4 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ deps =
coverage
nose-exclude
coverargs =
--with-coverage
--cover-tests
--cover-branches
--cover-inclusive
--with-coverage
--cover-tests
--cover-branches
--cover-inclusive

[testenv:gae]
deps =
Expand Down Expand Up @@ -49,11 +49,7 @@ deps =
gcloud
commands =
nosetests \
--exclude-dir=bigquery/tests/appengine \
--exclude-dir=bigquery/samples/appengine_auth \
--exclude-dir=appengine \
--exclude-dir=datastore/ndb \
--exclude-dir=localtesting \
{[testenv]coverargs} \
{posargs}

Expand Down