def test_workers(self): with make_server(num_workers=3) as server: self.assertEqual(len(server.workers), 3) for bad_num in (0, -10): with self.assertRaises(ValueError): make_server(num_workers=bad_num) # 1 worker does not spawn anything with make_server(num_workers=1) as server: self.assertEqual(0, len(server.workers))
def test_role(self): for role in ('responder', 'ResPonDer', 'filter', 'authorizer', FCGI_RESPONDER, FCGI_FILTER, FCGI_AUTHORIZER): with make_server_conn(role=role) as conn: self._run_get_values(conn) for bad_role in (979897, 'sdjflskdfj'): with self.assertRaises(ValueError): with make_server(role=bad_role): pass