示例#1
0
    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
示例#2
0
    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
示例#3
0
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
示例#4
0
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
示例#5
0
文件: globals.py 项目: mlys/gsapi
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
示例#6
0
    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']})
示例#7
0
    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']})
示例#8
0
 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')
示例#9
0
 def setUp(self):
     super(ModelsIndexesTests, self).setUp()
     self.sampDat = myyaml.pyObj(self.tests_data_yaml_dir + 'mdlsIndexes.yaml')
示例#10
0
文件: test_myyaml.py 项目: mlys/gsapi
 def test_parse_file(self):
     '''Doc this
         '''
     obj = myyaml.pyObj(self.tests_data_yaml_dir + 'cnts' + '.yaml')
     assert True