Ejemplo n.º 1
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '-n',
        action="store",
        default=0,
        dest="number_of_items",
        type=int,
        help="Number of test items in data store after initialization.")

    parser.add_argument(
        '-d',
        action="store",
        default=0,
        dest="delay",
        type=int,
        help=
        "Delay in finishing request in seconds. Used to simulate slow server connection."
    )

    QuestionRepository.create_table()
    QuestionRepository.truncate()
    QuestionRepository.populate(parser.parse_args().number_of_items)
    ItemsJSON.set_delay(parser.parse_args().delay)

    httpserver.serve(app, host='0.0.0.0', port='9001')
Ejemplo n.º 2
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-n', action="store", default=0, dest="number_of_items", type=int,
                        help="Number of test items in data store after initialization.")

    parser.add_argument('-d', action="store", default=0, dest="delay", type=int,
                        help="Delay in finishing request in seconds. Used to simulate slow server connection.")

    QuestionRepository.create_table()
    QuestionRepository.truncate()
    QuestionRepository.populate(parser.parse_args().number_of_items)
    ItemsJSON.set_delay(parser.parse_args().delay)

    httpserver.serve(app, host='0.0.0.0', port='9001')
Ejemplo n.º 3
0
    def test_updating_selected_items_using_get_request(self):
        QuestionRepository.populate(5)

        updated = ItemsJSON.timestamp_to_float(QuestionRepository.all().get().updated)

        self.update_items([5, 3, 1])

        new_items = self.retrieve_first_n_items_updated_after_given_timestamp(5, updated)
        self.assertEqual(3, len(new_items))