Beispiel #1
0
 def test_location_add_file_with_category(self) -> None:
     temp_file_path = os.path.join(self.tmpdir,
                                   ".".join(["temp_file", "txt"]))
     with open(temp_file_path, "wb") as tmp_file:
         tmp_file.write(b"TEST DATA FILE")
     add_file(self.client, temp_file_path, "LOCATION", self.location_1.id,
              "test_category")
     docs = get_location_documents(self.client, self.location_1)
     for doc in docs:
         self.assertEqual(doc.category, "test_category")
         delete_document(self.client, doc)
Beispiel #2
0
    def test_location_add_file(self) -> None:
        temp_file_path = os.path.join(self.tmpdir, ".".join(["temp_file", "txt"]))
        with open(temp_file_path, "wb") as tmp_file:
            tmp_file.write(b"TEST DATA FILE")

        add_file(
            client=self.client,
            local_file_path=temp_file_path,
            entity_type="LOCATION",
            entity_id=self.location_1.id,
        )

        docs = get_location_documents(client=self.client, location=self.location_1)
        self.assertEqual(len(docs), 1)
        for doc in docs:
            delete_document(self.client, doc)