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)
def test_url(self): url = 'https://gebn.co.uk' self.assertEqual( main._parse_argv(self._BASE_ARGV + ['--url', url]).url, url)
def test_url_title_no_url(self): with self.assertRaises(SystemExit), _suppress_stderr(): main._parse_argv(self._BASE_ARGV + ['--url-title', 'foo'])
def test_title(self): self.assertEqual( main._parse_argv(self._BASE_ARGV + ['-t', 'title']).title, 'title')
def test_timestamp(self): dt = pytz.utc.localize(datetime.datetime.utcnow()) self.assertEqual( main._parse_argv(self._BASE_ARGV + ['--timestamp', dt.isoformat()]).timestamp, dt)
def test_verbosity_implicit(self): self.assertEqual(main._parse_argv(self._BASE_ARGV).verbosity, 0)
def test_priority_invalid(self): with self.assertRaises(SystemExit), _suppress_stderr(): _ = main._parse_argv(self._BASE_ARGV + ['-p', '99'])
def test_user_missing(self): with self.assertRaises(SystemExit), _suppress_stderr(): _ = main._parse_argv(self._BASE_ARGV).user
def test_priority_default(self): self.assertEqual( main._parse_argv(self._BASE_ARGV).priority, Message.NORMAL)
def test_user_explicit(self): self.assertEqual( main._parse_argv(self._BASE_ARGV + ['-u', 'foo']).user, 'foo')
def test_user_implicit(self): self.assertEqual(main._parse_argv(self._BASE_ARGV).user, 'key')
def test_app_implicit(self): self.assertEqual(main._parse_argv(self._BASE_ARGV).app, 'token')
def test_app_explicit(self): self.assertEqual( main._parse_argv(self._BASE_ARGV + ['-a', 'foo']).app, 'foo')
def test_verbosity_count(self): self.assertEqual( main._parse_argv(self._BASE_ARGV + ['-vvvv']).verbosity, 4)
def test_message_missing(self): with self.assertRaises(SystemExit), _suppress_stderr(): main._parse_argv(self._CMD)
def test_priority_explicit(self): self.assertEqual( main._parse_argv(self._BASE_ARGV + ['-p', '1']).priority, Message.HIGH)
def test_message(self): self.assertEqual( main._parse_argv(self._BASE_ARGV).message, self._MESSAGE)
def test_version(self): with self.assertRaises(SystemExit), _suppress_stderr(): main._parse_argv(['-V'])