Exemple #1
0
    def test_conflicts_with_uses_period_conflict(self):
        period1 = PeriodFactory.build()
        period1.conflicts_with = Mock(return_value=False)
        period2 = PeriodFactory.build()
        sp1 = SectionPeriodFactory.build(period=period1)
        sp2 = SectionPeriodFactory.build(period=period2)

        self.assertFalse(sp1.conflicts_with(sp2))
        period1.conflicts_with.assert_called_with(period2)
Exemple #2
0
    def test_conflicts_with_uses_period_conflict(self):
        period1 = PeriodFactory.build()
        period1.conflicts_with = Mock(return_value=False)
        period2 = PeriodFactory.build()
        sp1 = SectionPeriodFactory.build(period=period1)
        sp2 = SectionPeriodFactory.build(period=period2)

        self.assertFalse(sp1.conflicts_with(sp2))
        period1.conflicts_with.assert_called_with(period2)
Exemple #3
0
 def test_to_json(self):
     period = PeriodFactory.build()
     period.toJSON = Mock(return_value={'lol': 1})
     sp = SectionPeriodFactory.build(
         id=None,
         instructor='foo',
         location='bar',
         kind='fizz',
         period=period,
     )
     expected = {
         'instructor': 'foo',
         'location': 'bar',
         'kind': 'fizz',
         'lol': 1,
         'id': None,
     }
     self.assertEqual(expected, sp.toJSON())
Exemple #4
0
 def test_to_json(self):
     period = PeriodFactory.build()
     period.toJSON = Mock(return_value={'lol': 1})
     sp = SectionPeriodFactory.build(
         id=None,
         instructor='foo',
         location='bar',
         kind='fizz',
         period=period,
     )
     expected = {
         'instructor': 'foo',
         'location': 'bar',
         'kind': 'fizz',
         'lol': 1,
         'id': None,
     }
     self.assertEqual(expected, sp.toJSON())