Exemplo n.º 1
0
 def test_school_related_models(self):
     s = self.create_school()
     self.assertTrue(isinstance(s, School))
     self.assertEqual(s.primary_alias, "Not Available")
     d = self.create_disclosure(s)
     self.assertTrue(isinstance(d, Disclosure))
     self.assertTrue(d.name in d.__unicode__())
     a = self.create_alias('Wizard U', s)
     self.assertTrue(isinstance(a, Alias))
     self.assertTrue(a.alias in a.__unicode__())
     self.assertEqual(s.primary_alias, a.alias)
     self.assertEqual(s.__unicode__(), a.alias + u" (%s)" % s.school_id)
     c = self.create_contact(s)
     self.assertTrue(isinstance(c, Contact))
     self.assertTrue(c.contact in c.__unicode__())
     self.assertTrue(s.primary_alias in c.__unicode__())
     n = self.create_nickname(s)
     self.assertTrue(isinstance(n, Nickname))
     self.assertTrue(n.nickname in n.__unicode__())
     p = self.create_program(s)
     self.assertTrue(isinstance(p, Program))
     self.assertTrue(p.program_name in p.__unicode__())
     self.assertTrue(print_vals(s) is None)
     self.assertTrue("Emerald City" in print_vals(s, val_list=True))
     self.assertTrue("Emerald City" in print_vals(s, val_dict=True)['city'])
     self.assertTrue("Emerald City" in print_vals(s, noprint=True))
Exemplo n.º 2
0
 def test_school_related_models(self):
     s = self.create_school()
     self.assertTrue(isinstance(s, School))
     self.assertEqual(s.primary_alias, "Not Available")
     d = self.create_disclosure(s)
     self.assertTrue(isinstance(d, Disclosure))
     self.assertTrue(d.name in d.__unicode__())
     a = self.create_alias('Wizard U', s)
     self.assertTrue(isinstance(a, Alias))
     self.assertTrue(a.alias in a.__unicode__())
     self.assertEqual(s.primary_alias, a.alias)
     self.assertEqual(s.__unicode__(), a.alias + u" (%s)" % s.school_id)
     c = self.create_contact()
     self.assertTrue(isinstance(c, Contact))
     self.assertTrue(c.contacts in c.__unicode__())
     n = self.create_nickname(s)
     self.assertTrue(isinstance(n, Nickname))
     self.assertTrue(n.nickname in n.__unicode__())
     self.assertTrue(n.nickname in s.nicknames)
     p = self.create_program(s)
     self.assertTrue(isinstance(p, Program))
     self.assertTrue(p.program_name in p.__unicode__())
     self.assertTrue(p.program_name in p.as_json())
     self.assertTrue('Bachelor' in p.get_level())
     noti = self.create_notification(s)
     self.assertTrue(isinstance(noti, Notification))
     self.assertTrue(noti.oid in noti.__unicode__())
     self.assertTrue(print_vals(s) is None)
     self.assertTrue("Emerald City" in print_vals(s, val_list=True))
     self.assertTrue("Emerald City" in print_vals(s, val_dict=True)['city'])
     self.assertTrue("Emerald City" in print_vals(s, noprint=True))
     self.assertTrue(s.convert_ope6() == '005555')
     self.assertTrue(s.convert_ope8() == '00555500')
     self.assertTrue('Bachelor' in s.get_highest_degree())
     s.ope6_id = 555555
     s.ope8_id = 55555500
     self.assertTrue(s.convert_ope6() == '555555')
     self.assertTrue(s.convert_ope8() == '55555500')
     s.ope6_id = None
     s.ope8_id = None
     self.assertTrue(s.convert_ope6() == '')
     self.assertTrue(s.convert_ope8() == '')
Exemplo n.º 3
0
 def test_school_related_models(self):
     s = self.create_school()
     self.assertTrue(isinstance(s, School))
     self.assertEqual(s.primary_alias, "Not Available")
     d = self.create_disclosure(s)
     self.assertTrue(isinstance(d, Disclosure))
     self.assertTrue(d.name in d.__unicode__())
     a = self.create_alias("Wizard U", s)
     self.assertTrue(isinstance(a, Alias))
     self.assertTrue(a.alias in a.__unicode__())
     self.assertEqual(s.primary_alias, a.alias)
     self.assertEqual(s.__unicode__(), a.alias + u" (%s)" % s.school_id)
     c = self.create_contact()
     self.assertTrue(isinstance(c, Contact))
     self.assertTrue(c.contact in c.__unicode__())
     n = self.create_nickname(s)
     self.assertTrue(isinstance(n, Nickname))
     self.assertTrue(n.nickname in n.__unicode__())
     p = self.create_program(s)
     self.assertTrue(isinstance(p, Program))
     self.assertTrue(p.program_name in p.__unicode__())
     self.assertTrue(p.program_name in p.as_json())
     self.assertTrue("Bachelor" in p.get_level())
     noti = self.create_notification(s)
     self.assertTrue(isinstance(noti, Notification))
     self.assertTrue(noti.oid in noti.__unicode__())
     self.assertTrue(print_vals(s) is None)
     self.assertTrue("Emerald City" in print_vals(s, val_list=True))
     self.assertTrue("Emerald City" in print_vals(s, val_dict=True)["city"])
     self.assertTrue("Emerald City" in print_vals(s, noprint=True))
     self.assertTrue(s.convert_ope6() == "005555")
     self.assertTrue(s.convert_ope8() == "00555500")
     self.assertTrue("Bachelor" in s.get_highest_degree())
     s.ope6_id = 555555
     s.ope8_id = 55555500
     self.assertTrue(s.convert_ope6() == "555555")
     self.assertTrue(s.convert_ope8() == "55555500")
     s.ope6_id = None
     s.ope8_id = None
     self.assertTrue(s.convert_ope6() == "")
     self.assertTrue(s.convert_ope8() == "")
Exemplo n.º 4
0
 def test_school_related_models(self):
     s = self.create_school()
     self.assertTrue(isinstance(s, School))
     self.assertEqual(s.primary_alias, "Not Available")
     d = self.create_disclosure(s)
     self.assertTrue(isinstance(d, Disclosure))
     self.assertTrue(d.name in d.__unicode__())
     a = self.create_alias('Wizard U', s)
     self.assertTrue(isinstance(a, Alias))
     self.assertTrue(a.alias in a.__unicode__())
     self.assertEqual(s.primary_alias, a.alias)
     self.assertEqual(s.__unicode__(), a.alias + u" (%s)" % s.school_id)
     c = self.create_contact(s)
     self.assertTrue(isinstance(c, Contact))
     self.assertTrue(c.contact in c.__unicode__())
     self.assertTrue(s.primary_alias in c.__unicode__())
     n = self.create_nickname(s)
     self.assertTrue(isinstance(n, Nickname))
     self.assertTrue(n.nickname in n.__unicode__())
     p = self.create_program(s)
     self.assertTrue(isinstance(p, Program))
     self.assertTrue(p.program_name in p.__unicode__())
     self.assertTrue(p.program_name in p.dump_json())
     self.assertTrue('Bachelor' in p.get_level())
     self.assertTrue(print_vals(s) is None)
     self.assertTrue("Emerald City" in print_vals(s, val_list=True))
     self.assertTrue("Emerald City" in print_vals(s, val_dict=True)['city'])
     self.assertTrue("Emerald City" in print_vals(s, noprint=True))
     self.assertTrue(s.convert_ope6() == '005555')
     self.assertTrue(s.convert_ope8() == '00555500')
     # print("school.degrees_highest is '{0}'".format(s.degrees_highest))
     # print("school.get_highest_degree returns '{0}'".format(s.get_highest_degree()))
     self.assertTrue('Bachelor' in s.get_highest_degree())
     s.ope6_id = 555555
     s.ope8_id = 55555500
     self.assertTrue(s.convert_ope6() == '555555')
     self.assertTrue(s.convert_ope8() == '55555500')
     s.ope6_id = None
     s.ope8_id = None
     self.assertTrue(s.convert_ope6() == '')
     self.assertTrue(s.convert_ope8() == '')
Exemplo n.º 5
0
    def test_school_related_models(self):
        s = self.create_school()
        self.assertTrue(isinstance(s, School))
        self.assertEqual(s.primary_alias, "Not Available")
        d = self.create_disclosure(s)
        self.assertTrue(isinstance(d, Disclosure))
        self.assertIn(d.name, d.__unicode__())
        a = self.create_alias('Wizard U', s)
        self.assertTrue(isinstance(a, Alias))
        self.assertIn(a.alias, a.__unicode__())
        self.assertEqual(s.primary_alias, a.alias)
        self.assertEqual(s.__unicode__(), a.alias + u" (%s)" % s.school_id)
        c = self.create_contact()
        self.assertTrue(isinstance(c, Contact))
        self.assertIn(c.contacts, c.__unicode__())
        n = self.create_nickname(s)
        self.assertTrue(isinstance(n, Nickname))
        self.assertIn(n.nickname, n.__unicode__())
        self.assertIn(n.nickname, s.nicknames)
        p = self.create_program(s)
        self.assertTrue(isinstance(p, Program))
        self.assertIn(p.program_name, p.__unicode__())
        self.assertIn(p.program_name, p.as_json())
        self.assertIn('Bachelor', p.get_level())
        noti = self.create_notification(s)
        self.assertTrue(isinstance(noti, Notification))
        self.assertIn(noti.oid, noti.__unicode__())
        self.assertIsInstance(print_vals(s, noprint=True), basestring)
        self.assertIn('Emerald City', print_vals(s,
                                                 val_list=True,
                                                 noprint=True))
        self.assertIn("Emerald City",
                      print_vals(s, val_dict=True, noprint=True)['city'])
        self.assertTrue("Emerald City" in print_vals(s, noprint=True))

        print_patcher = mock.patch('paying_for_college.models.print')
        with print_patcher as mock_print:
            self.assertIsInstance(print_vals(s, val_list=True), list)
            self.assertTrue(mock_print.called)

        with print_patcher as mock_print:
            self.assertIsNone(print_vals(s))
            self.assertTrue(mock_print.called)

        self.assertTrue(s.convert_ope6() == '005555')
        self.assertTrue(s.convert_ope8() == '00555500')
        self.assertTrue('Bachelor' in s.get_highest_degree())
        s.ope6_id = 555555
        s.ope8_id = 55555500
        self.assertTrue(s.convert_ope6() == '555555')
        self.assertTrue(s.convert_ope8() == '55555500')
        s.ope6_id = None
        s.ope8_id = None
        self.assertTrue(s.convert_ope6() == '')
        self.assertTrue(s.convert_ope8() == '')
Exemplo n.º 6
0
    def test_school_related_models(self):
        s = self.create_school()
        self.assertTrue(isinstance(s, School))
        self.assertEqual(s.primary_alias, "Not Available")
        d = self.create_disclosure(s)
        self.assertTrue(isinstance(d, Disclosure))
        self.assertTrue(d.name in d.__unicode__())
        a = self.create_alias('Wizard U', s)
        self.assertTrue(isinstance(a, Alias))
        self.assertTrue(a.alias in a.__unicode__())
        self.assertEqual(s.primary_alias, a.alias)
        self.assertEqual(s.__unicode__(), a.alias + u" (%s)" % s.school_id)
        c = self.create_contact()
        self.assertTrue(isinstance(c, Contact))
        self.assertTrue(c.contacts in c.__unicode__())
        n = self.create_nickname(s)
        self.assertTrue(isinstance(n, Nickname))
        self.assertTrue(n.nickname in n.__unicode__())
        self.assertTrue(n.nickname in s.nicknames)
        p = self.create_program(s)
        self.assertTrue(isinstance(p, Program))
        self.assertTrue(p.program_name in p.__unicode__())
        self.assertTrue(p.program_name in p.as_json())
        self.assertTrue('Bachelor' in p.get_level())
        noti = self.create_notification(s)
        self.assertTrue(isinstance(noti, Notification))
        self.assertTrue(noti.oid in noti.__unicode__())
        self.assertIsInstance(print_vals(s, noprint=True), basestring)
        self.assertTrue(
            'Emerald City' in print_vals(s, val_list=True, noprint=True)
        )
        self.assertTrue("Emerald City" in print_vals(s, val_dict=True, noprint=True)['city'])
        self.assertTrue("Emerald City" in print_vals(s, noprint=True))

        print_patcher = mock.patch('paying_for_college.models.print')
        with print_patcher as mock_print:
            self.assertIsInstance(print_vals(s, val_list=True), list)
            self.assertTrue(mock_print.called)

        with print_patcher as mock_print:
            self.assertIsNone(print_vals(s))
            self.assertTrue(mock_print.called)

        self.assertTrue(s.convert_ope6() == '005555')
        self.assertTrue(s.convert_ope8() == '00555500')
        self.assertTrue('Bachelor' in s.get_highest_degree())
        s.ope6_id = 555555
        s.ope8_id = 55555500
        self.assertTrue(s.convert_ope6() == '555555')
        self.assertTrue(s.convert_ope8() == '55555500')
        s.ope6_id = None
        s.ope8_id = None
        self.assertTrue(s.convert_ope6() == '')
        self.assertTrue(s.convert_ope8() == '')