def setUp(self): from app import app from util import now self.tests_data_yaml_dir = app.config['HOME_PATH'] + 'tests/data/yaml/' self.data_dir = app.config['HOME_PATH'] + 'data/' self.usecase = usecase.UseCase(self.tests_data_yaml_dir) self.usecase1 = usecase.UseCase(self.tests_data_yaml_dir) self.config = app.config app.config['DEBUG'] = True app.config['TESTING'] = True self._flush_db() g = globals.load() g['usr'] = {"OID": "50468de92558713d84b03fd7", "at": (-84.163063, 9.980516)} g['me'] = app.me g['pymongo'] = app.pymongo g['logger'] = app.logger self.g = g app.g = g # load lnkroles resp = postToMongo(ctrs.post.Post().post, self.data_dir + 'lnkroles') assert resp['status'] == 200 assert len(resp['response']['docs']) == len(resp['response']['yamlData']['data'])
def test_postToMongo(self): post = ctrs.post.Post().post resp = postToMongo(post, self.data_dir + 'lnkroles') assert resp['status'] == 200 assert len(resp['response']['docs']) == len(resp['response']['yamlData']['data'])