Sha256: 90ebcc34e1c2c8f55c8840ee452ffa3740f33c8310cec260972be4997db4c857

Contents?: true

Size: 1.94 KB

Versions: 25

Compression:

Stored size: 1.94 KB

Contents

RSpec.describe RubySMB::Dcerpc::Samr::SamrCreateUser2InDomainResponse do
  subject(:packet) { described_class.new }

  it { is_expected.to respond_to :user_handle }
  it { is_expected.to respond_to :granted_access }
  it { is_expected.to respond_to :relative_id }
  it { is_expected.to respond_to :error_status }
  it { is_expected.to respond_to :opnum }

  it 'is little endian' do
    expect(described_class.fields.instance_variable_get(:@hints)[:endian]).to eq :little
  end

  it 'is a BinData::Record' do
    expect(packet).to be_a(BinData::Record)
  end

  describe '#user_handle' do
    it 'is a SamprHandle structure' do
      expect(packet.user_handle).to be_a RubySMB::Dcerpc::Samr::SamprHandle
    end
  end

  describe '#granted_access' do
    it 'is a NdrUint32' do
      expect(packet.granted_access).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
    end
  end

  describe '#relative_id' do
    it 'is a NdrUint32 structure' do
      expect(packet.relative_id).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
    end
  end

  describe '#error_status' do
    it 'is a NdrUint32 structure' do
      expect(packet.error_status).to be_a RubySMB::Dcerpc::Ndr::NdrUint32
    end
  end

  describe '#initialize_instance' do
    it 'sets #opnum to SAMR_CREATE_USER2_IN_DOMAIN constant' do
      expect(packet.opnum).to eq(RubySMB::Dcerpc::Samr::SAMR_CREATE_USER2_IN_DOMAIN)
    end
  end

  it 'reads itself' do
    new_packet = described_class.new({
      user_handle: {
        context_handle_attributes: 0,
        context_handle_uuid: "fc873b90-d9a9-46a4-b9ea-f44bb1c272a7"
      },
      granted_access: 1,
      relative_id: 2,
      error_status: 0x11223344
    })
    expected_output = {
      user_handle: {
        context_handle_attributes: 0,
        context_handle_uuid: "fc873b90-d9a9-46a4-b9ea-f44bb1c272a7"
      },
      granted_access: 1,
      relative_id: 2,
      error_status: 0x11223344
    }
    expect(packet.read(new_packet.to_binary_s)).to eq(expected_output)
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
ruby_smb-3.3.13 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.12 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.11 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.10 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.9 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.7 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.6 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.5 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.4 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.3 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.2 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.1 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.3.0 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.2.8 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.2.7 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.2.6 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.2.5 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.2.4 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.2.3 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb
ruby_smb-3.2.2 spec/lib/ruby_smb/dcerpc/samr/samr_create_user2_in_domain_response_spec.rb