forked from cloudendpoints/endpoints-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresource_container_test.py
More file actions
52 lines (42 loc) · 2.05 KB
/
Copy pathresource_container_test.py
File metadata and controls
52 lines (42 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Copyright 2017 Google Inc. All Rights Reserved.
#
# 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.
"""Tests for endpoints.resource_container."""
import json
import unittest
import test_util
from endpoints import api_config
from endpoints import message_types
from endpoints import messages
from endpoints import remote
from endpoints import resource_container
package = 'ResourceContainerTest'
class AllBasicFields(messages.Message):
"""Contains all field types."""
bool_value = messages.BooleanField(1, variant=messages.Variant.BOOL)
bytes_value = messages.BytesField(2, variant=messages.Variant.BYTES)
double_value = messages.FloatField(3, variant=messages.Variant.DOUBLE)
float_value = messages.FloatField(5, variant=messages.Variant.FLOAT)
int32_value = messages.IntegerField(6, variant=messages.Variant.INT32)
int64_value = messages.IntegerField(7, variant=messages.Variant.INT64)
string_value = messages.StringField(8, variant=messages.Variant.STRING)
uint32_value = messages.IntegerField(9, variant=messages.Variant.UINT32)
uint64_value = messages.IntegerField(10, variant=messages.Variant.UINT64)
sint32_value = messages.IntegerField(11, variant=messages.Variant.SINT32)
sint64_value = messages.IntegerField(12, variant=messages.Variant.SINT64)
datetime_value = message_types.DateTimeField(14)
class ResourceContainerTest(unittest.TestCase):
def testResourceContainer(self):
rc = resource_container.ResourceContainer(
**{field.name: field for field in AllBasicFields.all_fields()})
self.assertEqual(rc.body_message_class, message_types.VoidMessage)