Example #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)
Example #2
0
 def test_url(self):
     url = 'https://gebn.co.uk'
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['--url', url]).url, url)
Example #3
0
 def test_url_title_no_url(self):
     with self.assertRaises(SystemExit), _suppress_stderr():
         main._parse_argv(self._BASE_ARGV + ['--url-title', 'foo'])
Example #4
0
 def test_title(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['-t', 'title']).title, 'title')
Example #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)
Example #6
0
 def test_verbosity_implicit(self):
     self.assertEqual(main._parse_argv(self._BASE_ARGV).verbosity, 0)
Example #7
0
 def test_priority_invalid(self):
     with self.assertRaises(SystemExit), _suppress_stderr():
         _ = main._parse_argv(self._BASE_ARGV + ['-p', '99'])
Example #8
0
 def test_user_missing(self):
     with self.assertRaises(SystemExit), _suppress_stderr():
         _ = main._parse_argv(self._BASE_ARGV).user
Example #9
0
 def test_priority_default(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV).priority, Message.NORMAL)
Example #10
0
 def test_user_explicit(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['-u', 'foo']).user, 'foo')
Example #11
0
 def test_user_implicit(self):
     self.assertEqual(main._parse_argv(self._BASE_ARGV).user, 'key')
Example #12
0
 def test_app_implicit(self):
     self.assertEqual(main._parse_argv(self._BASE_ARGV).app, 'token')
Example #13
0
 def test_app_explicit(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['-a', 'foo']).app, 'foo')
Example #14
0
 def test_verbosity_count(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['-vvvv']).verbosity, 4)
Example #15
0
 def test_message_missing(self):
     with self.assertRaises(SystemExit), _suppress_stderr():
         main._parse_argv(self._CMD)
Example #16
0
 def test_priority_explicit(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV + ['-p', '1']).priority,
         Message.HIGH)
Example #17
0
 def test_message(self):
     self.assertEqual(
         main._parse_argv(self._BASE_ARGV).message, self._MESSAGE)
Example #18
0
 def test_version(self):
     with self.assertRaises(SystemExit), _suppress_stderr():
         main._parse_argv(['-V'])