Skip to content

Commit

Permalink
CV2-4072: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Jan 15, 2024
1 parent bf1bd44 commit 54633f7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 41 deletions.
33 changes: 1 addition & 32 deletions test/controllers/graphql_controller_10_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def setup
create_team_user team: t, user: u, role: 'admin'
create_team_user team: t, user: u2
authenticate_with_user(u)
query = "query GetById { team(id: \"#{t.id}\") { team_users { edges { node { user { dbid, get_send_email_notifications, get_send_successful_login_notifications, get_send_failed_login_notifications, source { medias(first: 1) { edges { node { id } } } }, annotations(first: 1) { edges { node { id } } }, team_users(first: 1) { edges { node { id } } }, bot { get_description, get_role, get_version, get_source_code_url } } } } } } }"
query = "query GetById { team(id: \"#{t.id}\") { team_users { edges { node { user { dbid, source { medias(first: 1) { edges { node { id } } } } } } } } } }"
post :create, params: { query: query, team: t.slug }

assert_response :success
Expand Down Expand Up @@ -546,37 +546,6 @@ def setup
assert_response 401
end

test "should get project media assignments" do
u = create_user
u2 = create_user
t = create_team
create_team_user user: u, team: t, status: 'member'
create_team_user user: u2, team: t, status: 'member'
p = create_project team: t
pm1 = create_project_media project: p
pm2 = create_project_media project: p
pm3 = create_project_media project: p
pm4 = create_project_media project: p
s1 = create_status status: 'in_progress', annotated: pm1
s2 = create_status status: 'in_progress', annotated: pm2
s3 = create_status status: 'in_progress', annotated: pm3
s4 = create_status status: 'verified', annotated: pm4
t1 = create_task annotated: pm1
t2 = create_task annotated: pm3
s1.assign_user(u.id)
s2.assign_user(u.id)
s3.assign_user(u.id)
s4.assign_user(u2.id)
authenticate_with_user(u)
post :create, params: { query: "query GetById { user(id: \"#{u.id}\") { assignments(first: 10) { edges { node { dbid, assignments(first: 10, user_id: #{u.id}, annotation_type: \"task\") { edges { node { dbid } } } } } } } }" }
assert_response :success
data = JSON.parse(@response.body)['data']['user']
assert_equal [pm3.id, pm2.id, pm1.id], data['assignments']['edges'].collect{ |x| x['node']['dbid'] }
assert_equal [t2.id], data['assignments']['edges'][0]['node']['assignments']['edges'].collect{ |x| x['node']['dbid'].to_i }
assert_equal [], data['assignments']['edges'][1]['node']['assignments']['edges']
assert_equal [t1.id], data['assignments']['edges'][2]['node']['assignments']['edges'].collect{ |x| x['node']['dbid'].to_i }
end

test "should not get private team by slug" do
authenticate_with_user
create_team slug: 'team', name: 'Team', private: true
Expand Down
9 changes: 0 additions & 9 deletions test/controllers/graphql_controller_7_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,6 @@ def teardown
end
end

test "should get user confirmed" do
u = create_user
authenticate_with_user(u)
post :create, params: { query: "query GetById { user(id: \"#{u.id}\") { confirmed } }" }
assert_response :success
data = JSON.parse(@response.body)['data']['user']
assert data['confirmed']
end

test "should get timezone from header" do
authenticate_with_user
@request.headers['X-Timezone'] = 'America/Bahia'
Expand Down

0 comments on commit 54633f7

Please sign in to comment.