Пример #1
0
    def test_create_valid_report_with_content(self):
        data = deepcopy(dummy_data)
        data['content'] = sample_report_header_yaml
        response = yield self.request('/report', "POST", data)
        response_body = json.loads(response.body)
        self.assertIn('backend_version', response_body)
        self.assertIn('report_id', response_body)
        self.filenames.add(response_body['report_id'])

        closeReport(response_body['report_id'])
Пример #2
0
    def test_create_valid_report_with_content(self):
        data = deepcopy(dummy_data)
        data['content'] = sample_report_header_yaml
        response = yield self.request('/report', "POST", data)
        response_body = json.loads(response.body)
        self.assertIn('backend_version', response_body)
        self.assertIn('report_id', response_body)
        self.filenames.add(response_body['report_id'])

        closeReport(response_body['report_id'])
Пример #3
0
    def test_create_and_update_report(self):
        response = yield self.request('/report', "POST", dummy_data)
        response_body = json.loads(response.body)
        self.assertIn('backend_version', response_body)
        self.assertIn('report_id', response_body)

        report_id = response_body['report_id']
        response = yield self.update_report(report_id)
        response_body = json.loads(response.body)

        with open(report_id) as f:
            self.filenames.add(report_id)
            written_report = yaml.safe_load_all(f)

            written_report_header = written_report.next()
            for key in dummy_data.keys():
                self.assertEqual(written_report_header[key], dummy_data[key])
            self.assertEqual(yaml.safe_load(sample_report_entry_yaml),
                             written_report.next())

        closeReport(report_id)
Пример #4
0
    def test_create_and_update_report(self):
        response = yield self.request('/report', "POST", dummy_data)
        response_body = json.loads(response.body)
        self.assertIn('backend_version', response_body)
        self.assertIn('report_id', response_body)

        report_id = response_body['report_id']
        response = yield self.update_report(report_id)
        response_body = json.loads(response.body)

        with open(report_id) as f:
            self.filenames.add(report_id)
            written_report = yaml.safe_load_all(f)

            written_report_header = written_report.next()
            for key in dummy_data.keys():
                self.assertEqual(written_report_header[key], dummy_data[key])
            self.assertEqual(yaml.safe_load(sample_report_entry_yaml),
                             written_report.next())

        closeReport(report_id)