Пример #1
0
 def setUp(self):
     self.db = note.mongoDB('noteTest')
Пример #2
0
    def test_mongodb_create_2(self):

        self.db = note.mongoDB('noteTest', "mongodb://localhost:27017")
        assert self.db.noteDB['IDs'].find({"currentMax": 0}).count() == 1
        assert self.db.noteDB['IDs'].find({"unusedIDs": []}).count() == 1
        assert self.db.noteDB['IDs'].find().count() == 2
Пример #3
0
import argparse
import markdown
from flask import Flask
from flask import request
from flask import Response
from flask import render_template
from flask import Markup
from functools import wraps
from note import mongoDB

# FIXME - there should be a better way to do this
with open(os.path.expanduser("~/.note.conf")) as fd:
   config = json.loads(fd.read())

try:
   db = mongoDB("note", uri=config['database']['uri'])
except:
   db = mongoDB("note")

app = Flask(__name__)
app.jinja_env.trim_blocks = True


def parseArgs():
   parser = argparse.ArgumentParser(description='Run Note Web Server')
   parser.add_argument('--debug', '-d', default=False, action='store_true',
                       help='Turn on debug mode')

   args = parser.parse_args()

   return args