Sha256: 30af61e6b92c8aa122dce81109dabae1739b017dd82ca974bbb5b31cf19ec474

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

require_relative "../test_helper"

module Telnyx
  class SimCardTest < Test::Unit::TestCase
    should "retrieve sim card" do
      sim = Telnyx::SimCard.retrieve "123"
      assert_requested(:get, "#{Telnyx.api_base}/v2/sim_cards/123")
      assert_kind_of Telnyx::SimCard, sim
    end

    should "list sim cards" do
      simlist = Telnyx::SimCard.list
      assert_requested(:get, "#{Telnyx.api_base}/v2/sim_cards")
      assert_kind_of Telnyx::ListObject, simlist
    end

    should "save sim card" do
      sim = Telnyx::SimCard.retrieve "123"
      sim.save
      assert_requested(:get, "#{Telnyx.api_base}/v2/sim_cards/123")
    end

    should "register sim card" do
      Telnyx::SimCard.register(registration_codes: %w[1234567890 123456332601])
      assert_requested(:post, "#{Telnyx.api_base}/v2/actions/register/sim_cards")
    end

    context "actions" do
      should "deactivate" do
        sim = Telnyx::SimCard.retrieve "123"
        sim.deactivate
        assert_requested(:post, "#{Telnyx.api_base}/v2/sim_cards/123/actions/deactivate")
      end

      should "activate" do
        sim = Telnyx::SimCard.retrieve "123"
        sim.activate
        assert_requested(:post, "#{Telnyx.api_base}/v2/sim_cards/123/actions/activate")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
telnyx-0.1.0 test/telnyx/sim_card_test.rb