1919import snippets
2020
2121
22- def test_create_model_using_keyword_arguments (testbed):
23- result = snippets.create_model_using_keyword_arguments ()
22+ def test_create_entity_using_keyword_arguments (testbed):
23+ result = snippets.create_entity_using_keyword_arguments ()
2424 assert isinstance(result, snippets.Account)
2525
2626
27- def test_create_model_using_attributes (testbed):
28- result = snippets.create_model_using_attributes ()
27+ def test_create_entity_using_attributes (testbed):
28+ result = snippets.create_entity_using_attributes ()
2929 assert isinstance(result, snippets.Account)
3030
3131
32- def test_create_model_using_populate (testbed):
33- result = snippets.create_model_using_populate ()
32+ def test_create_entity_using_populate (testbed):
33+ result = snippets.create_entity_using_populate ()
3434 assert isinstance(result, snippets.Account)
3535
3636
@@ -39,52 +39,52 @@ def test_demonstrate_model_constructor_type_checking(testbed):
3939 snippets.demonstrate_model_constructor_type_checking()
4040
4141
42- def test_dmonstrate_model_attribute_type_checking (testbed):
42+ def test_demonstrate_entity_attribute_type_checking (testbed):
4343 with pytest.raises(datastore_errors.BadValueError):
44- snippets.dmonstrate_model_attribute_type_checking (
45- snippets.create_model_using_keyword_arguments ())
44+ snippets.demonstrate_entity_attribute_type_checking (
45+ snippets.create_entity_using_keyword_arguments ())
4646
4747
48- def test_save_model (testbed):
49- result = snippets.save_model (
50- snippets.create_model_using_keyword_arguments ())
48+ def test_save_entity (testbed):
49+ result = snippets.save_entity (
50+ snippets.create_entity_using_keyword_arguments ())
5151 assert isinstance(result, snippets.ndb.Key)
5252
5353
54- def test_get_model (testbed):
55- sandy_key = snippets.save_model (
56- snippets.create_model_using_keyword_arguments ())
57- result = snippets.get_model (sandy_key)
54+ def test_get_entity (testbed):
55+ sandy_key = snippets.save_entity (
56+ snippets.create_entity_using_keyword_arguments ())
57+ result = snippets.get_entity (sandy_key)
5858 assert isinstance(result, snippets.Account)
5959
6060
6161def test_get_key_kind_and_id(testbed):
62- sandy_key = snippets.save_model (
63- snippets.create_model_using_keyword_arguments ())
62+ sandy_key = snippets.save_entity (
63+ snippets.create_entity_using_keyword_arguments ())
6464 kind_string, ident = snippets.get_key_kind_and_id(sandy_key)
6565 assert kind_string == 'Account'
6666 assert isinstance(ident, long)
6767
6868
6969def test_get_url_safe_key(testbed):
70- sandy_key = snippets.save_model (
71- snippets.create_model_using_keyword_arguments ())
70+ sandy_key = snippets.save_entity (
71+ snippets.create_entity_using_keyword_arguments ())
7272 result = snippets.get_url_safe_key(sandy_key)
7373 assert isinstance(result, str)
7474
7575
76- def test_get_model_from_url_safe_key (testbed):
77- sandy_key = snippets.save_model (
78- snippets.create_model_using_keyword_arguments ())
79- result = snippets.get_model_from_url_safe_key (
76+ def test_get_entity_from_url_safe_key (testbed):
77+ sandy_key = snippets.save_entity (
78+ snippets.create_entity_using_keyword_arguments ())
79+ result = snippets.get_entity_from_url_safe_key (
8080 snippets.get_url_safe_key(sandy_key))
8181 assert isinstance(result, snippets.Account)
8282 assert result.username == 'Sandy'
8383
8484
8585def test_get_key_and_numeric_id_from_url_safe_key(testbed):
86- sandy_key = snippets.save_model (
87- snippets.create_model_using_keyword_arguments ())
86+ sandy_key = snippets.save_entity (
87+ snippets.create_entity_using_keyword_arguments ())
8888 urlsafe = snippets.get_url_safe_key(sandy_key)
8989 key, ident, kind_string = (
9090 snippets.get_key_and_numeric_id_from_url_safe_key(urlsafe))
@@ -93,25 +93,25 @@ def test_get_key_and_numeric_id_from_url_safe_key(testbed):
9393 assert isinstance(kind_string, str)
9494
9595
96- def test_update_model_from_key (testbed):
97- sandy = snippets.create_model_using_keyword_arguments ()
98- sandy_key = snippets.save_model (sandy)
96+ def test_update_entity_from_key (testbed):
97+ sandy = snippets.create_entity_using_keyword_arguments ()
98+ sandy_key = snippets.save_entity (sandy)
9999 urlsafe = snippets.get_url_safe_key(sandy_key)
100100 key, ident, kind_string = (
101101 snippets.get_key_and_numeric_id_from_url_safe_key(urlsafe))
102- snippets.update_model_from_key (key)
102+ snippets.update_entity_from_key (key)
103103 assert key.get().email == 'sandy@example.co.uk'
104104
105105
106- def test_delete_model (testbed):
107- sandy = snippets.create_model_using_keyword_arguments ()
108- snippets.save_model (sandy)
109- snippets.delete_model (sandy)
106+ def test_delete_entity (testbed):
107+ sandy = snippets.create_entity_using_keyword_arguments ()
108+ snippets.save_entity (sandy)
109+ snippets.delete_entity (sandy)
110110 assert sandy.key.get() is None
111111
112112
113- def test_create_model_with_named_key (testbed):
114- result = snippets.create_model_with_named_key ()
113+ def test_create_entity_with_named_key (testbed):
114+ result = snippets.create_entity_with_named_key ()
115115 assert 'sandy@example.com' == result
116116
117117
@@ -121,13 +121,13 @@ def test_set_key_directly(testbed):
121121 assert account.key.id() == 'sandy@example.com'
122122
123123
124- def test_create_model_with_generated_id (testbed):
125- result = snippets.create_model_with_generated_id ()
124+ def test_create_entity_with_generated_id (testbed):
125+ result = snippets.create_entity_with_generated_id ()
126126 assert isinstance(result.key.id(), long)
127127
128128
129- def test_demonstrate_models_with_parent_hierarchy (testbed):
130- snippets.demonstrate_models_with_parent_hierarchy ()
129+ def test_demonstrate_entities_with_parent_hierarchy (testbed):
130+ snippets.demonstrate_entities_with_parent_hierarchy ()
131131
132132
133133def test_equivalent_ways_to_define_key_with_parent(testbed):
@@ -139,14 +139,14 @@ def test_create_root_key(testbed):
139139 assert result.id() == 'sandy@example.com'
140140
141141
142- def test_create_model_with_parent_keys (testbed):
143- result = snippets.create_model_with_parent_keys ()
142+ def test_create_entity_with_parent_keys (testbed):
143+ result = snippets.create_entity_with_parent_keys ()
144144 assert result.message_text == 'Hello'
145145
146146
147- def test_get_parent_key_of_model (testbed):
148- initial_revision = snippets.create_model_with_parent_keys ()
149- result = snippets.get_parent_key_of_model (initial_revision)
147+ def test_get_parent_key_of_entity (testbed):
148+ initial_revision = snippets.create_entity_with_parent_keys ()
149+ result = snippets.get_parent_key_of_entity (initial_revision)
150150 assert result.kind() == 'Message'
151151
152152
@@ -155,26 +155,27 @@ def test_operate_on_multiple_keys_at_once(testbed):
155155 snippets.Account(email='a@a.com'), snippets.Account(email='b@b.com')])
156156
157157
158- def test_create_expando_model (testbed):
159- result = snippets.create_expando_model ()
158+ def test_create_entity_using_expando_model (testbed):
159+ result = snippets.create_entity_using_expando_model ()
160160 assert result.foo == 1
161161
162162
163163def test_get_properties_defined_on_expando(testbed):
164164 result = snippets.get_properties_defined_on_expando(
165- snippets.create_expando_model ())
165+ snippets.create_entity_using_expando_model ())
166166 assert result['foo'] is not None
167167 assert result['bar'] is not None
168168 assert result['tags'] is not None
169169
170170
171- def test_create_expando_model_with_defined_properties (testbed):
172- result = snippets.create_expando_model_with_defined_properties ()
171+ def test_create_entity_using_expando_model_with_defined_properties (testbed):
172+ result = snippets.create_expando_model_entity_with_defined_properties ()
173173 assert result.name == 'Sandy'
174174
175175
176- def test_create_expando_model_that_isnt_indexed_by_default(testbed):
177- result = snippets.create_expando_model_that_isnt_indexed_by_default()
176+ def test_create_expando_model_entity_that_isnt_indexed_by_default(testbed):
177+ result = (
178+ snippets.create_expando_model_entity_that_isnt_indexed_by_default())
178179 assert result['foo']
179180 assert result['bar']
180181
0 commit comments