Esempio n. 1
0
def get_collection_titles(cids=''):
    from time import sleep
    sleep(1)
    cids_arr = cids.split(",")
    coll_info = collection.get_titles(cids_arr, mydao)
    resp = make_response(json.dumps(coll_info, indent=4), 200)
    return resp
Esempio n. 2
0
def get_collection_titles(cids=''):
    from time import sleep
    sleep(1)
    cids_arr = cids.split(",")
    coll_info = collection.get_titles(cids_arr, mydao)
    resp = make_response(json.dumps(coll_info, indent=4), 200)
    return resp
    def test_get_names(self):
        colls = [
            {"_id": "1", "title": "title 1"},
            {"_id": "2", "title": "title 2"},
            {"_id": "3", "title": "title 3"}
        ]

        # put all these in the db
        for doc in self.d.db.update(colls):
            pass

        titlesDict = collection.get_titles(["1", "2", "3"], self.d)
        assert_equals(titlesDict["1"], "title 1")
        assert_equals(titlesDict["3"], "title 3")
    def test_get_titles(self):
        colls = [
            {"collection_id": "1", "title": "title 1"},
            {"collection_id": "2", "title": "title 2"},
            {"collection_id": "3", "title": "title 3"}
        ]

        for collection_params in colls:
            new_collection = collection.Collection(**collection_params)
            self.db.session.add(new_collection)

        self.db.session.commit()
        titlesDict = collection.get_titles(["1", "2", "3"])
        assert_equals(titlesDict["1"], "title 1")
        assert_equals(titlesDict["3"], "title 3")
Esempio n. 5
0
    def test_get_titles(self):
        colls = [
            {"collection_id": "1", "title": "title 1"},
            {"collection_id": "2", "title": "title 2"},
            {"collection_id": "3", "title": "title 3"}
        ]

        for collection_params in colls:
            new_collection = collection.Collection(**collection_params)
            self.db.session.add(new_collection)

        self.db.session.commit()
        titlesDict = collection.get_titles(["1", "2", "3"])
        assert_equals(titlesDict["1"], "title 1")
        assert_equals(titlesDict["3"], "title 3")