Пример #1
0
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'
Пример #2
0
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 == '*****@*****.**'
Пример #3
0
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)
Пример #4
0
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)
Пример #5
0
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)
Пример #6
0
def test_save_model(testbed):
    result = snippets.save_model(
        snippets.create_model_using_keyword_arguments())
    assert isinstance(result, snippets.ndb.Key)
Пример #7
0
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)
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)