Exemplo n.º 1
0
    def test(self):
        if os.path.exists(TEST_FILE_NAME):
            os.remove(TEST_FILE_NAME)

        row = "0c:f3:ee:00:f6:33,8deefbb9f7384297804096668bb44281,5000,3221,-63,-78"
        queue.queue_beacon(row)

        #
        # check the key exists
        #
        buffer = queue.read_list()
        key = "8deefbb9f7384297804096668bb44281_5000_3221"
        new_assert = queue.key_exists(key, buffer)
        self.assertEqual(new_assert, True)

        row2 = "0c:f3:ee:00:f6:33,8deefbb9f7384297804096668bb44281,5001,3221,-63,-78"
        queue.queue_beacon(row2)

        #
        # check the key exists
        #
        buffer2 = queue.read_list()
        key2 = "8deefbb9f7384297804096668bb44281_5001_3221"
        new_assert2 = queue.key_exists(key2, buffer2)
        self.assertEqual(new_assert2, True)

        new_assert3 = queue.key_exists(key, buffer2)
        self.assertEqual(new_assert3, True)
Exemplo n.º 2
0
    def test(self):
        if os.path.exists(TEST_FILE_NAME):
            os.remove(TEST_FILE_NAME)

        buffer = queue.read_list()

        result = queue.key_exists("frog", buffer)

        self.assertEqual(result, False)

        queue.add_key("frog")

        new_buffer = queue.read_list()
        new_assert = queue.key_exists("frog", new_buffer)
        self.assertEqual(new_assert, True)
Exemplo n.º 3
0
    def test(self):
        if os.path.exists(TEST_FILE_NAME):
            os.remove(TEST_FILE_NAME)

        buffer = queue.read_list()

        self.assertEqual(buffer, [])
Exemplo n.º 4
0
    def test(self):
        output = open(TEST_FILE_NAME, "wt")
        output.write("apple\n")
        output.write("ball\n")
        output.close()

        buffer = queue.read_list()

        result = queue.key_exists("frog", buffer)

        self.assertEqual(result, False)

        queue.add_key("frog")

        new_buffer = queue.read_list()
        new_assert = queue.key_exists("frog", new_buffer)
        self.assertEqual(new_assert, True)
Exemplo n.º 5
0
    def test(self):
        output = open(TEST_FILE_NAME, "wt")
        output.write("apple\n")
        output.write("ball\n")
        output.close()

        buffer = queue.read_list()

        self.assertEqual(buffer, ["apple", "ball"])
Exemplo n.º 6
0
    def test(self):
        output = open(TEST_FILE_NAME, "wt")
        output.write("apple\n")
        output.write("ball\n")
        output.close()

        buffer = queue.read_list()

        result = queue.key_exists("sua", buffer)

        self.assertEqual(result, False)
Exemplo n.º 7
0
    def test(self):
        row = "0c:f3:ee:00:f6:33,8deefbb9f7384297804096668bb44281,5000,3221,-63,-78"
        queue.queue_beacon(row)

        #
        # check the key exists
        #
        buffer = queue.read_list()
        key = "8deefbb9f7384297804096668bb44281_5000_3221"
        new_assert = queue.key_exists(key, buffer)
        self.assertEqual(new_assert, True)
Exemplo n.º 8
0
def send_keys():
    items = queue.read_list()
    if len(items) > 0:
        send_key = items[0]

        try:
            send(1, send_key)
        except Exception, ex:
            send(1, "Invalid key. %s" % ex)

        queue.remove_key(send_key)
Exemplo n.º 9
0
    def test(self):
        queue.SCANNED_DATA_FILENAME = "./junk.test"

        #
        # check the key exists
        #
        buffer = queue.read_list()
        key = "8deefbb9f7384297804096668bb44281_5000_3221"
        new_assert = queue.key_exists(key, buffer)
        self.assertEqual(new_assert, True)
        for item in buffer:
            print(item)

        queue.SCANNED_DATA_FILENAME = TEST_FILE_NAME