def test_get_model_from_url_safe_key(testbed): sandy_key = snippets.save_model( snippets.create_model_using_keyword_arguments()) result = snippets.get_model_from_url_safe_key( snippets.get_url_safe_key(sandy_key)) assert isinstance(result, snippets.Account) assert result.username == 'Sandy'
def test_update_model_from_key(testbed): sandy = snippets.create_model_using_keyword_arguments() sandy_key = snippets.save_model(sandy) urlsafe = snippets.get_url_safe_key(sandy_key) key, ident, kind_string = ( snippets.get_key_and_numeric_id_from_url_safe_key(urlsafe)) snippets.update_model_from_key(key) assert key.get().email == '*****@*****.**'
def test_get_key_and_numeric_id_from_url_safe_key(testbed): sandy_key = snippets.save_model( snippets.create_model_using_keyword_arguments()) urlsafe = snippets.get_url_safe_key(sandy_key) key, ident, kind_string = ( snippets.get_key_and_numeric_id_from_url_safe_key(urlsafe)) assert isinstance(key, ndb.Key) assert isinstance(ident, long) assert isinstance(kind_string, str)
def test_get_url_safe_key(testbed): sandy_key = snippets.save_model( snippets.create_model_using_keyword_arguments()) result = snippets.get_url_safe_key(sandy_key) assert isinstance(result, str)
def test_get_key_kind_and_id(testbed): sandy_key = snippets.save_model( snippets.create_model_using_keyword_arguments()) kind_string, ident = snippets.get_key_kind_and_id(sandy_key) assert kind_string == 'Account' assert isinstance(ident, long)
def test_save_model(testbed): result = snippets.save_model( snippets.create_model_using_keyword_arguments()) assert isinstance(result, snippets.ndb.Key)
def test_delete_model(testbed): sandy = snippets.create_model_using_keyword_arguments() snippets.save_model(sandy) snippets.delete_model(sandy) assert sandy.key.get() is None
def test_get_model(client): sandy_key = snippets.save_model( snippets.create_model_using_keyword_arguments()) result = snippets.get_model(sandy_key) assert isinstance(result, snippets.Account)