示例#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'])