コード例 #1
0
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()
        ndb.get_context().clear_cache()

        Project(description="desc").put()
        User(key=ndb.Key(pairs=[(User, 1)])).put()
        Project(name="name123",
                creator=ndb.Key(pairs=[(User, 1)]),
                createdOn=datetime.datetime(2016, 4, 25)).put()
        self.project = Project.query(Project.name == u'name123').fetch()[0]
コード例 #2
0
    def create_transaction_from_params(self):
        new_transaction = Transaction()
        new_transaction.project = Project.get_by_id(int(str(self.request.get("projectId")))).key
        new_transaction.user = User.query(User.google_id == str(self.request.get("userId"))).get().key
        new_transaction.money = int(self.request.get("money"))

        return new_transaction
コード例 #3
0
    def create_transaction_from_params(self):
        new_transaction = Transaction()
        new_transaction.project = Project.get_by_id(
            int(str(self.request.get("projectId")))).key
        new_transaction.user = User.query(
            User.google_id == str(self.request.get("userId"))).get().key
        new_transaction.money = int(self.request.get("money"))

        return new_transaction
コード例 #4
0
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()
        ndb.get_context().clear_cache()

        Project(description="desc").put()
        User(key=ndb.Key(pairs=[(User, 1)])).put()
        Project(name="name123", creator=ndb.Key(pairs=[(User, 1)]), createdOn=datetime.datetime(2016, 4, 25)).put()
        self.project = Project.query(Project.name == u'name123').fetch()[0]
コード例 #5
0
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()
        ndb.get_context().clear_cache()

        User(name="FancyName",
             google_id="123id",
             key=ndb.Key(pairs=[(User, 1)])).put()
        Project(name="name123",
                creator=ndb.Key(pairs=[(User, 1)]),
                createdOn=datetime.datetime(2016, 4, 25),
                key=ndb.Key(pairs=[(Project, 1)])).put()
        File(project=ndb.Key(pairs=[(Project, 1)]),
             blobKey=ndb.BlobKey("someGreatKey")).put()
        self.project = Project.query(Project.key == ndb.Key(
            pairs=[(Project, 1)])).fetch()[0]
        self.file = File.query(File.key == ndb.Key(pairs=[(File,
                                                           1)])).fetch()[0]
コード例 #6
0
ファイル: file_model.py プロジェクト: JLucka/kickstarter-dev
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()
        ndb.get_context().clear_cache()

        User(name="FancyName", google_id="123id", key=ndb.Key(pairs=[(User, 1)])).put()
        Project(name="name123", creator=ndb.Key(pairs=[(User, 1)]), createdOn=datetime.datetime(2016, 4, 25),
                key=ndb.Key(pairs=[(Project, 1)])).put()
        File(project=ndb.Key(pairs=[(Project, 1)]), blobKey=ndb.BlobKey("someGreatKey")).put()
        self.project = Project.query(Project.key == ndb.Key(pairs=[(Project, 1)])).fetch()[0]
        self.file = File.query(File.key == ndb.Key(pairs=[(File, 1)])).fetch()[0]
コード例 #7
0
    def setUp(self):
        self.testbed = testbed.Testbed()
        self.testbed.activate()
        self.testbed.init_datastore_v3_stub()
        self.testbed.init_memcache_stub()
        ndb.get_context().clear_cache()

        User(name="FancyName", google_id="123id", key=ndb.Key(pairs=[(User, 1)])).put()
        Project(name="name123", creator=ndb.Key(pairs=[(User, 1)]),
                createdOn=datetime.datetime(2016, 4, 25), key=ndb.Key(pairs=[(Project, 1)])).put()
        Transaction(project=ndb.Key(pairs=[(Project, 1)]), user=ndb.Key(pairs=[(User, 1)]),
                    time_stamp=datetime.datetime(2016, 4, 25),  key=ndb.Key(pairs=[(Transaction, 1)])).put()
        self.transaction = Transaction.query(Transaction.key == ndb.Key(pairs=[(Transaction, 1)])).fetch()[0]
コード例 #8
0
 def hide(self):
     project = Project.get_by_id(int(str(self.request.get("projectId"))))
     project.hide()
コード例 #9
0
 def post(self):
     project = Project.get_by_id(int(self.request.get('projectId'))).key
     files = json.loads(str(self.request.get('files')))
     attach_to_project(files, project)
     self.response.out.status = 200
コード例 #10
0
 def hide(self):
     project = Project.get_by_id(int(str(self.request.get("projectId"))))
     project.hide()