예제 #1
0
 def test_cancel_sn(self, tracker):
     sn = '1234'
     container = Mock()
     admin = Admin(container)
     canceled = admin.cancel(sn=sn)
     tracker.return_value.cancel.assert_called_once_with(sn)
     self.assertEqual(canceled, [tracker.return_value.cancel.return_value])
예제 #2
0
 def test_cancel_sn(self, tracker):
     sn = '1234'
     container = Mock()
     admin = Admin(container)
     canceled = admin.cancel(sn=sn)
     tracker.return_value.cancel.assert_called_once_with(sn)
     self.assertEqual(canceled, [tracker.return_value.cancel.return_value])
예제 #3
0
    def test_cancel_criteria(self, tracker, builder):
        sn = '1234'
        name = 'joe'
        criteria = {'eq': name}
        tracker.return_value.find.return_value = [sn]

        # test
        admin = Admin()
        canceled = admin.cancel(criteria=criteria)

        # validation
        builder.return_value.build.assert_called_once_with(criteria)
        tracker.return_value.cancel.assert_called_once_with(sn)
        self.assertEqual(canceled, [tracker.return_value.cancel.return_value])
예제 #4
0
    def test_cancel_criteria(self, tracker, builder):
        sn = '1234'
        name = 'joe'
        criteria = {'eq': name}
        tracker.return_value.find.return_value = [sn]

        # test
        admin = Admin()
        canceled = admin.cancel(criteria=criteria)

        # validation
        builder.return_value.build.assert_called_once_with(criteria)
        tracker.return_value.cancel.assert_called_once_with(sn)
        self.assertEqual(canceled, [tracker.return_value.cancel.return_value])
예제 #5
0
 def cancel(self, sn=None, criteria=None):
     container = Container()
     admin = Admin(container)
     return admin.cancel(sn=sn, criteria=criteria)
예제 #6
0
파일: manager.py 프로젝트: stbenjam/gofer
 def cancel(self, sn=None, criteria=None):
     container = Container()
     admin = Admin(container)
     return admin.cancel(sn=sn, criteria=criteria)