我正在启动一个 App Engine 应用程序。我开始定义一些我需要的简单模型。我想为我的应用程序编写测试(那将是我第一次这样做)。我看不到我应该测试什么。我已经研究过如何做到这一点(https://developers.google.com/appengine/docs/python/tools/localunittesting),但我只是不知道要测试什么......
到目前为止,这是我的代码:
class User(db.Model):
email = db.EmailProperty()
name = db.StringProperty()
class Service(db.Model):
name = db.StringProperty(required=True)
class UserService(db.Model):
user_id = db.ReferenceProperty(User,
required=True,
collection_name='user_services')
service_id = db.ReferenceProperty(Service,
required=True)
access_token = db.StringProperty(required=True)
refresh_token = db.StringProperty(required=True)
class LocalServer(db.Model):
authentication_token = db.StringProperty(required=True)
class Task(db.Model):
user_service_id = db.Reference(UserService,
required=True,
collection_name='tasks')
local_server_id = db.ReferenceProperty(LocalServer,
required=True,
collection_name='tasks')
creation_date = db.DateTimeProperty(auto_now_add=True,
required=True)
completion_date = db.DateTimeProperty(required=True)
number_of_files = db.IntegerProperty(required=True)
status = db.StringProperty(required=True,
choices=('created', 'validated', 'in_progress', 'done'))