def test_fs_outgoing_dump(self):
     out = fs_adaptor.OutgoingQueue()
     expected = {
         'valid': [],
         'invalid': [],
         'errors': []
     }
     self.assertEqual(out.dump(), expected)
Example #2
0
def send_ingest_requests_to_lax(request_list):
    "for each article we want to send a request "
    incoming = fs_adaptor.SimpleQueue(path_list=request_list)
    outgoing = fs_adaptor.OutgoingQueue()
    adaptor.do(incoming, outgoing)
    # ... ?
    LOG.info("done - %s requests consumed" % len(request_list))
    return outgoing.dump()
    def setUp(self):
        self.ingest_dir = join(self.fixtures_dir, 'dir-ingest')
        self.ingest_v1_dir = join(self.ingest_dir, 'v1')
        self.out = fs_adaptor.OutgoingQueue()

        self.inc = fs_adaptor.IncomingQueue(self.ingest_v1_dir, conf.INGEST)
        # 09560, artificially promoted to top of stack
        self.valid_request = list(self.inc)[0]
    def test_fs_outgoing_invalid(self):
        inc = fs_adaptor.IncomingQueue(self.ingest_dir, conf.PUBLISH)
        out = fs_adaptor.OutgoingQueue()

        valid_request = list(inc)[0]
        valid_response = adapt.mkresponse(conf.PUBLISHED, "dummy-published-message", request=valid_request)
        valid_response_json = utils.json_dumps(valid_response)
        out.write(valid_response_json)
        self.assertEqual(len(out.valids), 1)
        self.assertEqual(len(out.invalids), 0)
        self.assertEqual(len(out.errors), 0)
    def test_fs_outgoing_valid(self):
        "valid responses can be written without errors"
        inc = fs_adaptor.IncomingQueue(self.ingest_dir, 'ingest')
        out = fs_adaptor.OutgoingQueue()

        valid_request = list(inc)[0]
        valid_response = adapt.mkresponse(conf.INGESTED, "dummy-ingested-message", request=valid_request)
        valid_response_json = utils.json_dumps(valid_response)
        out.write(valid_response_json)
        self.assertEqual(len(out.valids), 1)
        self.assertEqual(len(out.invalids), 0)
        self.assertEqual(len(out.errors), 0)
Example #6
0
def read_from_fs(path, **kwargs):
    "generates messages from a directory, writes responses to a log file"
    kwargs['path'] = path
    incoming = fs_adaptor.IncomingQueue(**kwargs)
    outgoing = fs_adaptor.OutgoingQueue()
    return incoming, outgoing