Esempio n. 1
0
    def test_validate_invariants_edge(self):
        data = MockProgram()
        data.start = datetime.datetime(2009, 1, 2)
        data.end = datetime.datetime(2009, 1, 2)

        try:
            IProgram.validateInvariants(data)
        except:
            self.fail()
Esempio n. 2
0
    def test_validate_invariants_edge(self):
        data = MockProgram()
        data.start = datetime.datetime(2009, 1, 2)
        data.end = datetime.datetime(2009, 1, 2)

        try:
            IProgram.validateInvariants(data)
        except:
            self.fail()
Esempio n. 3
0
    def test_validate_invariants_fail(self):
        data = MockProgram()
        data.start = datetime.datetime(2009, 1, 2)
        data.end = datetime.datetime(2009, 1, 1)

        try:
            IProgram.validateInvariants(data)
            self.fail()
        except StartBeforeEnd:
            pass
Esempio n. 4
0
    def test_validate_invariants_fail(self):
        data = MockProgram()
        data.start = datetime.datetime(2009, 1, 2)
        data.end = datetime.datetime(2009, 1, 1)

        try:
            IProgram.validateInvariants(data)
            self.fail()
        except StartBeforeEnd:
            pass
Esempio n. 5
0
def possibleTracks(context):

    # we put the import here to avoid a circular import
    from example.conference.program import IProgram
    while context is not None and not IProgram.providedBy(context):
        context = aq_parent(aq_inner(context))

    values = []
    if context is not None and context.tracks:
        values = context.tracks

    return SimpleVocabulary.fromValues(values)
Esempio n. 6
0
def possibleTracks(context):

    # we put the import here to avoid a circular import
    from example.conference.program import IProgram
    while context is not None and not IProgram.providedBy(context):
        context = aq_parent(aq_inner(context))

    values = []
    if context is not None and context.tracks:
        values = context.tracks

    return SimpleVocabulary.fromValues(values)
Esempio n. 7
0
 def test_adding(self):
     self.folder.invokeFactory('example.conference.program', 'program1')
     p1 = self.folder['program1']
     self.failUnless(IProgram.providedBy(p1))
Esempio n. 8
0
 def test_factory(self):
     fti = queryUtility(IDexterityFTI, name='example.conference.program')
     factory = fti.factory
     new_object = createObject(factory)
     self.failUnless(IProgram.providedBy(new_object))
Esempio n. 9
0
 def test_adding(self):
     self.folder.invokeFactory("example.conference.program", "program1")
     p1 = self.folder["program1"]
     self.failUnless(IProgram.providedBy(p1))
Esempio n. 10
0
 def test_factory(self):
     fti = queryUtility(IDexterityFTI, name="example.conference.program")
     factory = fti.factory
     new_object = createObject(factory)
     self.failUnless(IProgram.providedBy(new_object))