equal
deleted
inserted
replaced
16 # You should have received a copy of the GNU Lesser General Public License along |
16 # You should have received a copy of the GNU Lesser General Public License along |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 |
18 |
19 from json import loads |
19 from json import loads |
20 from os.path import join |
20 from os.path import join |
|
21 import tempfile |
21 |
22 |
22 try: |
23 try: |
23 import requests |
24 import requests |
24 assert [int(n) for n in requests.__version__.split('.', 2)][:2] >= [1, 2] |
25 assert [int(n) for n in requests.__version__.split('.', 2)][:2] >= [1, 2] |
25 except (ImportError, AssertionError): |
26 except (ImportError, AssertionError): |
101 self.assertIn('lang="fr"', webreq.read()) |
102 self.assertIn('lang="fr"', webreq.read()) |
102 headers = {'Accept-Language': 'en'} |
103 headers = {'Accept-Language': 'en'} |
103 webreq = self.web_request(headers=headers) |
104 webreq = self.web_request(headers=headers) |
104 self.assertIn('lang="en"', webreq.read()) |
105 self.assertIn('lang="en"', webreq.read()) |
105 |
106 |
|
107 class LogQueriesTC(CubicWebServerTC): |
|
108 @classmethod |
|
109 def init_config(cls, config): |
|
110 super(LogQueriesTC, cls).init_config(config) |
|
111 cls.logfile = tempfile.NamedTemporaryFile() |
|
112 config.global_set_option('query-log-file', cls.logfile.name) |
|
113 |
|
114 def test_log_queries(self): |
|
115 self.web_request() |
|
116 self.assertTrue(self.logfile.read()) |
|
117 |
|
118 @classmethod |
|
119 def tearDownClass(cls): |
|
120 cls.logfile.close() |
|
121 |
106 |
122 |
107 if __name__ == '__main__': |
123 if __name__ == '__main__': |
108 unittest_main() |
124 unittest_main() |