|
390 | 390 | ) |
391 | 391 | end |
392 | 392 |
|
| 393 | + it 'check status for a task that does not exist' do |
| 394 | + expect do |
| 395 | + @client.get_task(SecureRandom.uuid) |
| 396 | + end.to raise_error( |
| 397 | + /Can't find task with id/ |
| 398 | + ) |
| 399 | + end |
| 400 | + |
393 | 401 | it 'request the export for a channel that does not exist' do |
394 | 402 | expect do |
395 | 403 | @client.export_channels({ type: 'messaging', id: SecureRandom.uuid }) |
|
420 | 428 | end |
421 | 429 | end |
422 | 430 |
|
| 431 | + it 'request delete channels' do |
| 432 | + ch1 = @client.channel('messaging', channel_id: SecureRandom.uuid) |
| 433 | + ch1.create(@random_user[:id]) |
| 434 | + ch1.send_message({ text: 'Hey Joni' }, @random_user[:id]) |
| 435 | + cid1 = "#{ch1.channel_type}:#{ch1.id}" |
| 436 | + |
| 437 | + ch2 = @client.channel('messaging', channel_id: SecureRandom.uuid) |
| 438 | + ch2.create(@random_user[:id]) |
| 439 | + ch2.send_message({ text: 'Hey Joni' }, @random_user[:id]) |
| 440 | + cid2 = "#{ch2.channel_type}:#{ch2.id}" |
| 441 | + |
| 442 | + resp = @client.delete_channels([cid1, cid2], hard_delete: true) |
| 443 | + expect(resp['task_id']).not_to be_empty |
| 444 | + |
| 445 | + task_id = resp['task_id'] |
| 446 | + loop do |
| 447 | + resp = @client.get_task(task_id) |
| 448 | + expect(resp['status']).not_to be_empty |
| 449 | + expect(resp['created_at']).not_to be_empty |
| 450 | + expect(resp['updated_at']).not_to be_empty |
| 451 | + if resp['status'] == 'completed' |
| 452 | + result = resp['result'] |
| 453 | + expect(result).not_to be_empty |
| 454 | + expect(result[cid1]).not_to be_empty |
| 455 | + expect(result[cid1]['status']).to eq 'ok' |
| 456 | + expect(result[cid2]).not_to be_empty |
| 457 | + expect(result[cid2]['status']).to eq 'ok' |
| 458 | + break |
| 459 | + end |
| 460 | + sleep(0.5) |
| 461 | + end |
| 462 | + end |
| 463 | + |
| 464 | + it 'request delete users' do |
| 465 | + user_id1 = SecureRandom.uuid |
| 466 | + user_id2 = SecureRandom.uuid |
| 467 | + @client.update_users([{ id: user_id1 }, { id: user_id2 }]) |
| 468 | + |
| 469 | + ch1 = @client.channel('messaging', channel_id: SecureRandom.uuid) |
| 470 | + ch1.create(user_id1) |
| 471 | + ch1.send_message({ text: 'Hey Joni' }, user_id1) |
| 472 | + |
| 473 | + ch2 = @client.channel('messaging', channel_id: SecureRandom.uuid) |
| 474 | + ch2.create(user_id2) |
| 475 | + ch2.send_message({ text: 'Hey Joni' }, user_id1) |
| 476 | + |
| 477 | + resp = @client.delete_users([user_id1, user_id2], user: StreamChat::HARD_DELETE) |
| 478 | + expect(resp['task_id']).not_to be_empty |
| 479 | + |
| 480 | + task_id = resp['task_id'] |
| 481 | + loop do |
| 482 | + resp = @client.get_task(task_id) |
| 483 | + expect(resp['status']).not_to be_empty |
| 484 | + expect(resp['created_at']).not_to be_empty |
| 485 | + expect(resp['updated_at']).not_to be_empty |
| 486 | + if resp['status'] == 'completed' |
| 487 | + result = resp['result'] |
| 488 | + expect(result).not_to be_empty |
| 489 | + expect(result[user_id1]).not_to be_empty |
| 490 | + expect(result[user_id1]['status']).to eq 'ok' |
| 491 | + expect(result[user_id2]).not_to be_empty |
| 492 | + expect(result[user_id2]['status']).to eq 'ok' |
| 493 | + break |
| 494 | + end |
| 495 | + sleep(0.5) |
| 496 | + end |
| 497 | + end |
| 498 | + |
423 | 499 | it 'check_sqs with an invalid queue url should fail' do |
424 | 500 | resp = @client.check_sqs('key', 'secret', 'https://foo.com/bar') |
425 | 501 | expect(resp['status']).to eq 'error' |
|
0 commit comments