blob: 9d2be476dfb109a52552474acc4b478952beaad8 [file] [log] [blame]
# Copyright 2014 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for timeline logic."""
import unittest
from melange.logic import timeline as timeline_logic
from seeder import program as program_seeder
from tests import timeline_utils
class IsBeforeStudentSignupTest(unittest.TestCase):
"""Unit tests for isBeforeStudentSignup function."""
def testBeforeStudentSignupStart(self):
"""Tests that true is returned before student sign-up starts."""
timeline = program_seeder.seedTimeline(
student_signup_start=timeline_utils.future())
result = timeline_logic.isBeforeStudentSignup(timeline)
self.assertTrue(result)
def testAfterStudentSignupStart(self):
"""Tests that false is returned after student sign-up starts."""
timeline = program_seeder.seedTimeline(
student_signup_start=timeline_utils.past())
result = timeline_logic.isBeforeStudentSignup(timeline)
self.assertFalse(result)
class IsBeforeOrgsAnnouncedTest(unittest.TestCase):
"""Unit tests for isBeforeOrgsAnnounced function."""
def testBeforeOrgsAnnounced(self):
"""Tests that true is returned before organizations are announced."""
timeline = program_seeder.seedTimeline(
accepted_organization_announced_deadline=timeline_utils.future())
result = timeline_logic.isBeforeOrgsAnnounced(timeline)
self.assertTrue(result)
def testAfterOrgsAnnounced(self):
"""Tests that false is returned after organizations are announced."""
timeline = program_seeder.seedTimeline(
accepted_organization_announced_deadline=timeline_utils.past())
result = timeline_logic.isBeforeOrgsAnnounced(timeline)
self.assertFalse(result)