Skip to content

Commit

Permalink
CV2-5154: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Sep 3, 2024
1 parent f416b9f commit 9dbca56
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 20 deletions.
4 changes: 0 additions & 4 deletions test/models/relationship_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ def setup
pm2 = create_project_media team: t, project: p2
assert_equal p1, pm1.reload.project
assert_equal p2, pm2.reload.project
assert_equal 1, p1.reload.medias_count
assert_equal 1, p2.reload.medias_count
r = create_relationship relationship_type: Relationship.confirmed_type, source_id: pm1.id, target_id: pm2.id
assert_equal p1, pm1.reload.project
assert_equal p1, pm2.reload.project
assert_equal 1, p1.reload.medias_count
assert_equal 0, p2.reload.medias_count
end

test "should create relationship between items with same media" do
Expand Down
4 changes: 0 additions & 4 deletions test/models/team_2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1117,16 +1117,12 @@ def setup
t.rules = rules.to_json
t.save!
pm1 = create_project_media project: p0, disable_es_callbacks: false
assert_equal 1, p0.reload.medias_count
assert_equal 0, p1.reload.medias_count
s = pm1.last_status_obj
s.status = 'in_progress'
s.save!
sleep 2
result = $repository.find(get_es_id(pm1))
assert_equal p1.id, result['project_id']
assert_equal 0, p0.reload.medias_count
assert_equal 1, p1.reload.medias_count
pm2 = create_project_media project: p0, disable_es_callbacks: false
sleep 2
assert_equal p1.id, pm1.reload.project_id
Expand Down
12 changes: 0 additions & 12 deletions test/models/team_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,6 @@ def setup
u = create_user
create_team_user team: t, user: u
assert_equal 0, p.reload.project_medias.count
assert_equal 0, p.reload.medias_count
rules = []
rules << {
"name": random_string,
Expand Down Expand Up @@ -547,7 +546,6 @@ def setup
create_project_media team: t
create_project_media user: u
assert_equal 1, p.reload.project_medias.count
assert_equal 1, p.reload.medias_count
end

test "should set default language when creating team" do
Expand All @@ -573,7 +571,6 @@ def setup
u2 = create_user
create_team_user team: t, user: u
assert_equal 0, p.reload.project_medias.count
assert_equal 0, p.reload.medias_count
rules = []
rules << {
"name": random_string,
Expand Down Expand Up @@ -636,7 +633,6 @@ def setup
assert_equal 0, pm2.reload.archived
assert_equal 0, pm3.reload.archived
assert_equal 1, p.reload.project_medias.count
assert_equal 1, p.reload.medias_count
end

test "should create default fieldsets when team is created" do
Expand Down Expand Up @@ -670,7 +666,6 @@ def setup
p = create_project team: t
pm = create_project_media team: t
assert_equal 0, p.reload.project_medias.count
assert_equal 0, p.reload.medias_count
rules = []
rules << {
"name": random_string,
Expand Down Expand Up @@ -702,12 +697,10 @@ def setup
tk.response = { annotation_type: 'task_response_single_choice', set_fields: { response_single_choice: { selected: 'Bar' }.to_json }.to_json }.to_json
tk.save!
assert_equal 0, p.reload.project_medias.count
assert_equal 0, p.reload.medias_count
tk = Task.find(tk.id)
tk.response = { annotation_type: 'task_response_single_choice', set_fields: { response_single_choice: { selected: 'Foo' }.to_json }.to_json }.to_json
tk.save!
assert_equal 1, p.reload.project_medias.count
assert_equal 1, p.reload.medias_count
end

test "should match rule by assignment" do
Expand All @@ -719,7 +712,6 @@ def setup
p = create_project team: t
pm = create_project_media team: t
assert_equal 0, p.reload.project_medias.count
assert_equal 0, p.reload.medias_count
rules = []
rules << {
"name": random_string,
Expand Down Expand Up @@ -749,7 +741,6 @@ def setup
t.save!
Assignment.create! assigned: pm.last_status_obj.becomes(Annotation), assigner: create_user, user: u
assert_equal 1, p.reload.project_medias.count
assert_equal 1, p.reload.medias_count
end

test "should match rule by text task answer" do
Expand All @@ -760,7 +751,6 @@ def setup
p = create_project team: t
pm = create_project_media team: t
assert_equal 0, p.reload.project_medias.count
assert_equal 0, p.reload.medias_count
rules = []
rules << {
"name": random_string,
Expand Down Expand Up @@ -792,12 +782,10 @@ def setup
tk.response = { annotation_type: 'task_response_free_text', set_fields: { response_free_text: 'test test' }.to_json }.to_json
tk.save!
assert_equal 0, p.reload.project_medias.count
assert_equal 0, p.reload.medias_count
tk = Task.find(tk.id)
tk.response = { annotation_type: 'task_response_free_text', set_fields: { response_free_text: 'test foo test' }.to_json }.to_json
tk.save!
assert_equal 1, p.reload.project_medias.count
assert_equal 1, p.reload.medias_count
end

test "should allow default BotUser to be added on creation" do
Expand Down

0 comments on commit 9dbca56

Please sign in to comment.