class TestConfigurationSerializer(TestCase): def setUp(self): self.config = StdmConfiguration.instance() self.serializer = ConfigurationFileSerializer(config_path) def tearDown(self): self.config = None def test_save(self): populate_configuration(self.config) self.serializer.save() update_result = True #Hardwire result self.assertTrue(update_result) def test_load(self): self.serializer.load() read_result = True #Hardwire result self.assertTrue(read_result)
def save_configuration(): """ A util method for saving the configuration instance to the default file location. """ config_path = QDesktopServices.storageLocation(QDesktopServices.HomeLocation) \ + '/.stdm/configuration.stc' conf_serializer = ConfigurationFileSerializer(config_path) conf_serializer.save()
def save_configuration(): """ A util method for saving the configuration instance to the default file location. """ config_path = QStandardPaths.standardLocations(QStandardPaths.HomeLocation)[0] \ + '/.stdm/configuration.stc' conf_serializer = ConfigurationFileSerializer(config_path) conf_serializer.save()
class TestEntityModelFunc(TestCase): def setUp(self): self.config = StdmConfiguration.instance() self.serializer = ConfigurationFileSerializer(config_path) def tearDown(self): self.config = None def test_exec_(self): engine = create_alchemy_engine() self.serializer.load() profile = self.config.profile('Rural') party_ent = profile.social_tenure.party #Map entity to SQLAlchemy class party_cls = entity_model(party_ent) party = party_cls() savings_col = party_ent.column('savings') savings_ent = savings_col.value_list #Create savings value list object savings_cls = entity_model(savings_ent) savings_obj = savings_cls() savings = [] res = savings_obj.queryObject().all() savings = [r for r in res] #Set attributes party.number = 'FK09' party.first_name = 'Jermaine' party.last_name = 'Jackson' #Append all savings options setattr(party, 'ru_check_saving_options_collection', savings) #party.save() #Hardwire result read_result = False self.assertTrue(read_result)
def load_config(self): """ Load STDM configuration :return: """ stdm_config = None if QFile.exists(HOME + "/stdm/configuration.stc"): stdm_config = QFile(CONFIG_FILE) ConfigurationFileSerializer(stdm_config) profiles = StdmConfiguration.instance().profiles return profiles
class TestConfigurationSerializer(TestCase): def setUp(self): self.config = StdmConfiguration.instance() self.serializer = ConfigurationFileSerializer(config_path) def tearDown(self): self.config = None def test_save(self): populate_configuration(self.config) self.serializer.save() update_result = True self.assertTrue(update_result) def test_load(self): self.serializer.load() read_result = True self.assertTrue(read_result)
def setUp(self): self.config = StdmConfiguration.instance() self.serializer = ConfigurationFileSerializer(config_path)