コード例 #1
0
 def save_data(self):
     """ Save data to local database """
     if self.services:
         Service.objects.all().delete()
         for item in self.services:
             self.insert_lang_serv(Service(), [item, self.services[item]])
     if self.languages:
         Language.objects.all().delete()
         for item in self.languages:
             self.insert_lang_serv(Language(), [item, self.languages[item]])
     if self.counselors:
         CounselingAgency.objects.all().delete()
         for item in self.counselors:
             self.insert_counselor(item)
     else:
         self.errors += 'Error: there were no counselors returned from the HUD service'
コード例 #2
0
 def test_insert_lang_serv__empty(self):
     """ Testing insert_lang_serv, empty list """
     self.cmd.insert_lang_serv(Language(), [])
     self.assertTrue('Error while saving' in self.cmd.errors)
コード例 #3
0
 def test_insert_lang_serv__none(self):
     """ Testing insert_lang_serv, None """
     self.cmd.insert_lang_serv(Language(), None)
     self.assertTrue('Error while saving' in self.cmd.errors)
コード例 #4
0
 def test_insert_lang_serv__language(self):
     """ Testing insert_lang_serv, language data """
     language = ['Lang1', 'Language 1']
     self.cmd.insert_lang_serv(Language(), language)
     obj = Language.objects.get(abbr__exact='Lang1')
     self.assertTrue(obj.name == 'Language 1')
コード例 #5
0
ファイル: test_models.py プロジェクト: virginiacc/django-hud
 def test_language(self):
     lng = Language(name='English')
     self.assertEqual(unicode(lng), 'English')