def load(self, uc_file): fname = self.yaml_path + uc_file + '.yaml' try: usecases = myyaml.pyObj(fname) except: raise Exception('Failed to load yaml: ' + fname) uc_dat = {} for yamlname in ['cnt', 'prs']: fname = self.yaml_path + yamlname + '.yaml' try: uc_dat[yamlname] = myyaml.pyObj(fname) except: raise Exception('Failed to load yaml: ' + fname) self.uc_dat = uc_dat self.usecases = usecases
def go(): from models import Email, Prs cnts = myyaml.pyObj(self.tests_data_yaml_dir + 'cnts.yaml') for doc_dict in cnts.itervalues(): doc = Prs(**doc_dict) doc.save() assert doc.id coll = doc._get_collection() ret = coll.find_one({'_id': doc.id}) pass
def load(): g = myyaml.pyObj('globals.yaml') _cs = g['_cs'] _cs_keys = _cs.keys() for i in range(0, len(_cs)): key = _cs_keys[i] try: _cs[key]['modelClass'] = getattr(models, key) except: pass g['_cs'] = _cs return g
def post_sample_Prs(self): db = self.g['db'] usr = self.g['usr'] generic = controllers.Generic(self.g) cnts = myyaml.pyObj(self.tests_data_yaml_dir + 'cnts.yaml') prs_larry_stooge = cnts['larry_stooge'] response = controllers.Generic(self.g).post(**{'docs': [prs_larry_stooge]}) assert response['status'] == 200 sample_doc = response['response']['docs'][0]['doc'] return db['cnts'].find_one({'_id': sample_doc['_id']})
def post_sample_Prs(self): db = self.g['db'] usr = self.g['usr'] generic = controllers.Generic(self.g) cnts = myyaml.pyObj(self.tests_data_yaml_dir + 'cnts.yaml') prs_larry_stooge = cnts['larry_stooge'] response = controllers.Generic( self.g).post(**{'docs': [prs_larry_stooge]}) assert response['status'] == 200 sample_doc = response['response']['docs'][0]['doc'] return db['cnts'].find_one({'_id': sample_doc['_id']})
def setUp(self): super(CtrsPostTests, self).setUp() ucs = self.usecase ucs.load('usecases') self.ucs = ucs self.sampDat = myyaml.pyObj(self.tests_data_yaml_dir + 'ctrsPost')
def setUp(self): super(ModelsIndexesTests, self).setUp() self.sampDat = myyaml.pyObj(self.tests_data_yaml_dir + 'mdlsIndexes.yaml')
def test_parse_file(self): '''Doc this ''' obj = myyaml.pyObj(self.tests_data_yaml_dir + 'cnts' + '.yaml') assert True