Exemplo n.º 1
0
    def test_notional_table_setting_ok(self):
        ba = BusinessAreaDb()
        ba.title = "Dogs!"
        ba.save()

        s = FieldSettingDb()
        s.title = 'DOGGGG'
        s.setting_group = FEDS_BASIC_SETTING_GROUP
        s.setting_type = FEDS_INTEGER_SETTING
        s.setting_params = '{"title": "Dogs are the best!"}'
        s.save()

        t = NotionalTableDb()
        t.title = 'More dogs'
        t.business_area = ba
        t.save()

        ants = AvailableNotionalTableSettingDb()
        ants.table = t
        ants.table_setting = s
        ants.table_setting_order = 1
        ants.table_setting_params = '{"thing":"dog"}'
        ants.save()

        sqs = NotionalTableDb.objects.get(
            pk=t.pk).available_notional_table_settings.all()
        s2 = sqs[0]
        self.assertEqual(s2.title, s.title)
Exemplo n.º 2
0
    def test_make_business_area_ok(self):
        # Make a business area.
        t = "Dogs!"
        ba = BusinessAreaDb()
        ba.title = t
        ba.save()

        ba2 = BusinessAreaDb.objects.get(pk=ba.pk)
        self.assertEqual(ba2.title, t)
Exemplo n.º 3
0
    def test_notional_table_setting_bad_params(self):
        with self.assertRaises(ValidationError):
            ba = BusinessAreaDb()
            ba.title = "Dogs!"
            ba.save()

            t = NotionalTableDb()
            t.title = 'More dogs'
            t.business_area = ba

            s = FieldSettingDb()
            s.title = 'DOGGGG'
            s.setting_group = FEDS_BASIC_SETTING_GROUP
            s.setting_type = FEDS_INTEGER_SETTING
            s.setting_params = '{"title": "Dogs are the best!"}'
            s.save()

            ants = AvailableNotionalTableSettingDb()
            ants.table = t
            ants.table_setting = s
            ants.table_setting_order = 1
            ants.table_setting_params = '{thing":"dog"}'
            ants.save()
Exemplo n.º 4
0
 def test_make_business_area_whitespace_title(self):
     with self.assertRaises(ValidationError):
         ba = BusinessAreaDb()
         ba.title = '   '
         ba.save()