Skip to content

Commit f01dad9

Browse files
committed
fix integration tests
1 parent a2bf105 commit f01dad9

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

tests/integration/test_base_flow.py

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,28 @@ def test_datasources():
4141

4242

4343
def test_minds():
44-
ds_name2 = 'test_ds_'
45-
mind_name = 'test_mind_'
44+
ds_name = 'test_datasource_'
45+
ds_name2 = 'test_datasource2_'
46+
mind_name = 'int_test_mind_'
47+
mind_name2 = 'int_test_mind2_'
4648
prompt1 = 'answer in german'
4749
prompt2 = 'answer in spanish'
4850

49-
# remove previous object
50-
try:
51-
client.minds.drop(mind_name)
52-
except ObjectNotFound:
53-
...
51+
# remove previous objects
52+
for name in (mind_name, mind_name2):
53+
try:
54+
client.minds.drop(name)
55+
except ObjectNotFound:
56+
...
5457

5558
# prepare datasources
59+
ds_cfg = copy.copy(example_ds)
60+
ds_cfg.name = ds_name
5661
ds = client.datasources.create(example_ds, replace=True)
5762

5863
# second datasource
59-
example_ds2 = copy.copy(example_ds)
60-
example_ds2.name = ds_name2
64+
ds2_cfg = copy.copy(example_ds)
65+
ds2_cfg.name = ds_name2
6166

6267
# create
6368
mind = client.minds.create(
@@ -68,7 +73,7 @@ def test_minds():
6873
mind = client.minds.create(
6974
mind_name,
7075
replace=True,
71-
datasources=[ds.name, example_ds2],
76+
datasources=[ds.name, ds2_cfg],
7277
parameters={
7378
'prompt_template': prompt1
7479
}
@@ -84,7 +89,6 @@ def test_minds():
8489
assert len(mind_list) > 0
8590

8691
# rename & update
87-
mind_name2 = 'test_mind2_'
8892
mind.update(
8993
name=mind_name2,
9094
datasources=[ds.name],
@@ -104,11 +108,11 @@ def test_minds():
104108
assert mind.parameters['prompt_template'] == prompt2
105109

106110
# add datasource
107-
mind.add_datasource(example_ds2)
111+
mind.add_datasource(ds2_cfg)
108112
assert len(mind.datasources) == 2
109113

110114
# del datasource
111-
mind.del_datasource(example_ds2.name)
115+
mind.del_datasource(ds2_cfg.name)
112116
assert len(mind.datasources) == 1
113117

114118
# completion
@@ -122,6 +126,6 @@ def test_minds():
122126
assert success is True
123127

124128
# drop
125-
client.minds.drop(mind_name)
126-
client.datasources.drop(example_ds.name)
127-
client.datasources.drop(ds_name2)
129+
client.minds.drop(mind_name2)
130+
client.datasources.drop(ds.name)
131+
client.datasources.drop(ds2_cfg.name)

0 commit comments

Comments
 (0)