Exemple #1
0
 def test_main_fails_when_vcard_validator_fails_on_first_file(
         self, vcard_validator_mock, parse_arguments_mock):
     parse_arguments_mock.return_value = ARGUMENTS_WITH_PATHS
     vcard_validator_mock.side_effect = [
         mock.Mock(spec=vcard.VcardValidator, result='non-empty'),
         mock.Mock(spec=vcard.VcardValidator, result=None)
     ]
     self.assertEqual(1, vcard.main())
Exemple #2
0
 def test_main_fails_when_argument_parsing_fails(self, parse_arguments_mock):
     parse_arguments_mock.side_effect = vcard.UsageError('error')
     self.assertEqual(2, vcard.main())
Exemple #3
0
 def test_main_fails_when_vcard_validator_fails_on_first_file(self, vcard_validator_mock, parse_arguments_mock):
     parse_arguments_mock.return_value = ARGUMENTS_WITH_PATHS
     vcard_validator_mock.side_effect = [
         mock.Mock(spec=vcard.VcardValidator, result='non-empty'),
         mock.Mock(spec=vcard.VcardValidator, result=None)]
     self.assertEqual(1, vcard.main())
Exemple #4
0
 def test_main_fails_when_vcard_validator_fails(self, vcard_validator_mock, parse_arguments_mock):
     parse_arguments_mock.return_value = ARGUMENTS_WITH_PATH
     vcard_validator_mock.return_value.result = 'non-empty'
     self.assertEqual(1, vcard.main())
Exemple #5
0
 def test_main_succeeds_when_vcard_validator_returns_nothing(self, vcard_validator_mock, parse_arguments_mock):
     parse_arguments_mock.return_value = ARGUMENTS_WITH_PATH
     vcard_validator_mock.return_value.result = None
     self.assertEqual(0, vcard.main())
Exemple #6
0
 def test_main_fails_when_argument_parsing_fails(self,
                                                 parse_arguments_mock):
     parse_arguments_mock.side_effect = vcard.UsageError('error')
     self.assertEqual(2, vcard.main())
Exemple #7
0
 def test_main_fails_when_vcard_validator_fails(self, vcard_validator_mock,
                                                parse_arguments_mock):
     parse_arguments_mock.return_value = ARGUMENTS_WITH_PATH
     vcard_validator_mock.return_value.result = 'non-empty'
     self.assertEqual(1, vcard.main())
Exemple #8
0
 def test_main_succeeds_when_vcard_validator_returns_nothing(
         self, vcard_validator_mock, parse_arguments_mock):
     parse_arguments_mock.return_value = ARGUMENTS_WITH_PATH
     vcard_validator_mock.return_value.result = None
     self.assertEqual(0, vcard.main())