Пример #1
0
 def test_url_title(self):
     url = 'https://gebn.co.uk'
     url_title = 'Personal Website'
     self.assertEqual(
         main._parse_argv(
             self._BASE_ARGV +
             ['--url', url, '--url-title', url_title]).url_title, url_title)
Пример #2
0
 def test_url(self):
     url = 'https://gebn.co.uk'
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['--url', url]).url, url)
Пример #3
0
 def test_url_title_no_url(self):
     with self.assertRaises(SystemExit), _suppress_stderr():
         main._parse_argv(self._BASE_ARGV + ['--url-title', 'foo'])
Пример #4
0
 def test_title(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['-t', 'title']).title, 'title')
Пример #5
0
 def test_timestamp(self):
     dt = pytz.utc.localize(datetime.datetime.utcnow())
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV +
                          ['--timestamp', dt.isoformat()]).timestamp, dt)
Пример #6
0
 def test_verbosity_implicit(self):
     self.assertEqual(main._parse_argv(self._BASE_ARGV).verbosity, 0)
Пример #7
0
 def test_priority_invalid(self):
     with self.assertRaises(SystemExit), _suppress_stderr():
         _ = main._parse_argv(self._BASE_ARGV + ['-p', '99'])
Пример #8
0
 def test_user_missing(self):
     with self.assertRaises(SystemExit), _suppress_stderr():
         _ = main._parse_argv(self._BASE_ARGV).user
Пример #9
0
 def test_priority_default(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV).priority, Message.NORMAL)
Пример #10
0
 def test_user_explicit(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['-u', 'foo']).user, 'foo')
Пример #11
0
 def test_user_implicit(self):
     self.assertEqual(main._parse_argv(self._BASE_ARGV).user, 'key')
Пример #12
0
 def test_app_implicit(self):
     self.assertEqual(main._parse_argv(self._BASE_ARGV).app, 'token')
Пример #13
0
 def test_app_explicit(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['-a', 'foo']).app, 'foo')
Пример #14
0
 def test_verbosity_count(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['-vvvv']).verbosity, 4)
Пример #15
0
 def test_message_missing(self):
     with self.assertRaises(SystemExit), _suppress_stderr():
         main._parse_argv(self._CMD)
Пример #16
0
 def test_priority_explicit(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['-p', '1']).priority,
         Message.HIGH)
Пример #17
0
 def test_message(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV).message, self._MESSAGE)
Пример #18
0
 def test_version(self):
     with self.assertRaises(SystemExit), _suppress_stderr():
         main._parse_argv(['-V'])