Skip to content

Commit

Permalink
Fix mock opensearch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottKasoar committed Jun 12, 2024
1 parent 1a386b6 commit 492e672
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tests/test_opensearch_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ def test_push(self, abcd):
assert isinstance(atoms_2, Atoms)
atoms_2.set_cell([1, 1, 1])

abcd.refresh()
result = AtomsModel(
None,
None,
abcd.client.search(index="test_index")["hits"]["hits"][0]["_source"],
dict=abcd.client.search(index="test_index")["hits"]["hits"][0]["_source"],
).to_ase()
assert atoms_1 == result
assert atoms_2 != result
Expand Down Expand Up @@ -117,17 +116,14 @@ def test_bulk(self, abcd):
atoms_list.append(atoms_1)
atoms_list.append(atoms_2)
abcd.push(atoms_list)
abcd.refresh()
assert abcd.count() == 2

result_1 = AtomsModel(
None,
None,
abcd.client.search(index="test_index")["hits"]["hits"][0]["_source"],
dict=abcd.client.search(index="test_index")["hits"]["hits"][0]["_source"],
).to_ase()
result_2 = AtomsModel(
None,
None,
abcd.client.search(index="test_index")["hits"]["hits"][1]["_source"],
dict=abcd.client.search(index="test_index")["hits"]["hits"][1]["_source"],
).to_ase()
assert atoms_1 == result_1
assert atoms_2 == result_2
Expand All @@ -151,4 +147,5 @@ def test_count(self, abcd):
atoms.set_cell([1, 1, 1])
abcd.push(atoms)
abcd.push(atoms)
abcd.refresh()
assert abcd.count() == 2

0 comments on commit 492e672

Please sign in to comment.