Esempio 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)
Esempio 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)
Esempio 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, [])
Esempio 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)
Esempio 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"])
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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