Beispiel #1
0
 def test_json_format(self, m):
     m.return_value.query.return_value.all.return_value = [
         Proxy(),
     ]
     CliRunner().invoke(list_command, [
         '--format',
         'json',
     ])
Beispiel #2
0
 def test_table_format(self, m):
     m.return_value.query.return_value.all.return_value = [
         Proxy(),
     ]
     CliRunner().invoke(list_command, [
         '--format',
         'grid-table',
     ])
Beispiel #3
0
 def test_str(self):
     self.assertEqual(str(Proxy(id=self.proxy_id)), self.proxy_id)
Beispiel #4
0
 def test_line_format(self, m):
     m.return_value.query.return_value.all.return_value = [
         Proxy(created_at=datetime.datetime.now()),
     ]
     CliRunner().invoke(list_command)
Beispiel #5
0
 def test_copy(self):
     self.assertEqual(
         Proxy(id=self.proxy_id).copy(),
         {key: self.proxy_id
          for key in PROTOCOLS})
Beispiel #6
0
 def test_in(self):
     proxy = Proxy(id=self.proxy_id)
     for protocol in PROTOCOLS:
         self.assertTrue(protocol in proxy)
Beispiel #7
0
 def test_vote(self, m):
     Proxy(id=self.proxy_id).positive()
     Proxy(id=self.proxy_id).negative()
Beispiel #8
0
 def test_get_default(self):
     self.assertEqual(Proxy(id=self.proxy_id).get('spam', 'foo'), 'foo')
Beispiel #9
0
 def test_get(self):
     self.assertEqual(Proxy(id=self.proxy_id).get('http'), self.proxy_id)