Exemplo n.º 1
0
 def setUp(self):
     LucteriosTest.setUp(self)
     rmtree(get_user_dir(), True)
     default_financial()
     default_season()
     default_params()
     default_adherents()
     default_subscription()
     default_event_params()
     set_parameters(["team", "activite", "age", "licence", "genre", 'numero', 'birth'])
     add_default_degree()
Exemplo n.º 2
0
 def setUp(self):
     self.xfer_class = XferContainerAcknowledge
     LucteriosTest.setUp(self)
     rmtree(get_user_dir(), True)
     default_financial()
     default_season()
     default_params()
     default_adherents()
     default_subscription()
     default_event_params()
     set_parameters(
         ["team", "activite", "age", "licence", "genre", 'numero', 'birth'])
     add_default_degree()
Exemplo n.º 3
0
    def test_prestation(self):
        default_financial()
        default_season()
        default_params()

        self.factory.xfer = SeasonSubscription()
        self.calljson('/diacamma.member/seasonSubscription', {}, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'seasonSubscription')
        self.assert_count_equal('', 9)
        self.assert_json_equal('TAB', '__tab_1', 'Saison')
        self.assert_json_equal('TAB', '__tab_2', 'Les cotisations')
        self.assert_json_equal('TAB', '__tab_3', 'Les prestations')
        self.assertFalse('__tab_4' in self.json_data.keys(),
                         self.json_data.keys())
        self.assert_grid_equal(
            'prestation', {
                'name': "nom",
                'description': "description",
                'team': "group",
                'activity': "passion",
                'article.price': "prix"
            }, 0)

        self.factory.xfer = PrestationAddModify()
        self.calljson('/diacamma.member/prestationAddModify', {}, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'prestationAddModify')
        self.assert_count_equal('', 6)

        self.factory.xfer = PrestationAddModify()
        self.calljson(
            '/diacamma.member/prestationAddModify', {
                'SAVE': 'YES',
                'name': 'abc123',
                'description': 'blablabla',
                'team': 3,
                'activity': 2,
                'article': 1
            }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'prestationAddModify')

        self.factory.xfer = SeasonSubscription()
        self.calljson('/diacamma.member/seasonSubscription', {}, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'seasonSubscription')
        self.assert_count_equal('prestation', 1)
        self.assert_json_equal('', 'prestation/@0/name', "abc123")
        self.assert_json_equal('', 'prestation/@0/description', "blablabla")
        self.assert_json_equal('', 'prestation/@0/team', "team3")
        self.assert_json_equal('', 'prestation/@0/activity', "activity2")
        self.assert_json_equal('', 'prestation/@0/article.price', 12.34)

        self.factory.xfer = PrestationDel()
        self.calljson('/diacamma.member/prestationDel', {
            "prestation": 1,
            'CONFIRME': 'YES'
        }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'prestationDel')

        self.factory.xfer = SeasonSubscription()
        self.calljson('/diacamma.member/seasonSubscription', {}, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'seasonSubscription')
        self.assert_count_equal('prestation', 0)
Exemplo n.º 4
0
    def test_subscription(self):
        default_financial()
        default_season()
        set_parameters(
            ["activite", "age", "licence", "genre", 'numero', 'birth'])

        self.factory.xfer = SeasonSubscription()
        self.calljson('/diacamma.member/seasonSubscription', {}, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'seasonSubscription')
        self.assert_count_equal('', 7)
        self.assert_grid_equal(
            'subscriptiontype', {
                'name': "nom",
                'description': "description",
                'duration': "durée",
                'unactive': "désactivé",
                'price': "prix"
            }, 0)
        self.assert_json_equal('TAB', '__tab_1', 'Saison')
        self.assert_json_equal('TAB', '__tab_2', 'Les cotisations')
        self.assertFalse('__tab_3' in self.json_data.keys(),
                         self.json_data.keys())

        self.factory.xfer = SubscriptionTypeAddModify()
        self.calljson('/diacamma.member/subscriptionTypeAddModify', {}, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'subscriptionTypeAddModify')
        self.assert_count_equal('', 7)

        self.factory.xfer = SubscriptionTypeAddModify()
        self.calljson(
            '/diacamma.member/subscriptionTypeAddModify', {
                'SAVE': 'YES',
                'name': 'abc123',
                'description': 'blablabla',
                'duration': 1,
                'articles': '1;5'
            }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'subscriptionTypeAddModify')

        self.factory.xfer = SeasonSubscription()
        self.calljson('/diacamma.member/seasonSubscription', {}, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'seasonSubscription')
        self.assert_count_equal('subscriptiontype', 1)
        self.assert_json_equal('', 'subscriptiontype/@0/name', "abc123")
        self.assert_json_equal('', 'subscriptiontype/@0/description',
                               "blablabla")
        self.assert_json_equal('', 'subscriptiontype/@0/duration', 1)
        self.assert_json_equal('', 'subscriptiontype/@0/unactive', False)
        self.assert_json_equal('', 'subscriptiontype/@0/price', 76.44)

        self.factory.xfer = SubscriptionTypeShow()
        self.calljson('/diacamma.member/subscriptionTypeShow',
                      {"subscriptiontype": 1}, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'subscriptionTypeShow')
        self.assert_count_equal('', 7)
        self.assert_json_equal('LABELFORM', 'articles', ["ABC1", "ABC5"])

        self.factory.xfer = SubscriptionTypeDel()
        self.calljson('/diacamma.member/subscriptionTypeDel', {
            "subscriptiontype": 1,
            'CONFIRME': 'YES'
        }, False)
        self.assert_observer('core.acknowledge', 'diacamma.member',
                             'subscriptionTypeDel')

        self.factory.xfer = SeasonSubscription()
        self.calljson('/diacamma.member/seasonSubscription', {}, False)
        self.assert_observer('core.custom', 'diacamma.member',
                             'seasonSubscription')
        self.assert_count_equal('subscriptiontype', 0)
Exemplo n.º 5
0
    def test_subscription(self):
        default_financial()
        default_season()

        self.factory.xfer = SeasonSubscription()
        self.call('/diacamma.member/memberConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'memberConf')
        self.assert_count_equal('COMPONENTS/*', 10)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/HEADER', 5)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/HEADER[@name="name"]', "nom")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/HEADER[@name="description"]', "description")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/HEADER[@name="duration"]', "durée")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/HEADER[@name="unactive"]', "désactivé")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/HEADER[@name="price"]', "prix")
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/RECORD', 0)

        self.factory.xfer = SubscriptionTypeAddModify()
        self.call('/diacamma.member/subscriptionAddModify', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'subscriptionAddModify')
        self.assert_count_equal('COMPONENTS/*', 19)

        self.factory.xfer = SubscriptionTypeAddModify()
        self.call('/diacamma.member/subscriptionAddModify',
                  {'SAVE': 'YES', 'name': 'abc123', 'description': 'blablabla', 'duration': 1, 'articles': '1;5'}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.member', 'subscriptionAddModify')

        self.factory.xfer = SeasonSubscription()
        self.call('/diacamma.member/memberConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'memberConf')
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/RECORD', 1)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/RECORD[1]/VALUE[@name="name"]', "abc123")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/RECORD[1]/VALUE[@name="description"]', "blablabla")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/RECORD[1]/VALUE[@name="duration"]', "périodique")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/RECORD[1]/VALUE[@name="unactive"]', "0")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/RECORD[1]/VALUE[@name="price"]', "76.44€")

        self.factory.xfer = SubscriptionTypeShow()
        self.call(
            '/diacamma.member/subscriptionShow', {"subscriptiontype": 1}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'subscriptionShow')
        self.assert_count_equal('COMPONENTS/*', 13)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="articles"]/HEADER', 6)
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="articles"]/RECORD', 2)
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="articles"]/RECORD[1]/VALUE[@name="reference"]', "ABC1")
        self.assert_xml_equal(
            'COMPONENTS/GRID[@name="articles"]/RECORD[2]/VALUE[@name="reference"]', "ABC5")

        self.factory.xfer = SubscriptionTypeDel()
        self.call(
            '/diacamma.member/subscriptionDel', {"subscriptiontype": 1, 'CONFIRME': 'YES'}, False)
        self.assert_observer(
            'core.acknowledge', 'diacamma.member', 'subscriptionDel')

        self.factory.xfer = SeasonSubscription()
        self.call('/diacamma.member/memberConf', {}, False)
        self.assert_observer(
            'core.custom', 'diacamma.member', 'memberConf')
        self.assert_count_equal(
            'COMPONENTS/GRID[@name="subscriptiontype"]/RECORD', 0)