Sha256: 1e8a0bbc5c8058222c3b3e41e79ea1a15a372d91499e1d1300c85c712d915089

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

require 'highline'

require 'gooddata/cli/terminal'
require 'gooddata/commands/auth'

describe GoodData::Command::Auth do
  ORIG_TERMINAL = GoodData::CLI::DEFAULT_TERMINAL

  before(:all) do
    @input = StringIO.new
    @output = StringIO.new
    @terminal = HighLine.new(@input, @output)

    GoodData::CLI::DEFAULT_TERMINAL = @terminal
  end

  after(:all) do
    GoodData::CLI::DEFAULT_TERMINAL = ORIG_TERMINAL
  end


  before(:each) do
    ConnectionHelper::create_default_connection
  end

  it "Is Possible to create GoodData::Command::Auth instance" do
    cmd = GoodData::Command::Auth.new()
    cmd.should be_a(GoodData::Command::Auth)
  end

  describe "#credentials_file" do
    it "Returns credentials_file" do
      GoodData::Command::Auth.credentials_file
    end
  end

  describe "#ensure_credentials" do
    it "Ensures credentials existence" do
      pending("Mock STDIO")
    end
  end

  describe "#ask_for_credentials" do
    credentials = {
      :email => 'joedoe@example.com',
      :password => 'secretPassword',
      :token => 't0k3n1sk0',
    }

    it 'Interactively asks user for crendentials' do
      pending("Mock STDIO")

      @input << credentials[:email] << "\n"
      @input << credentials[:password] << "\n"
      @input << credentials[:token] << "\n"
      @input.rewind

      GoodData::Command::Auth.ask_for_credentials
    end
  end

  describe "#store" do
    it 'Stores credentials' do
      pending("Mock STDIO")
    end
  end

  describe "#unstore" do
    it 'Removes stored credentials' do
      pending("Mock fileutils")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gooddata-0.6.0 spec/unit/commands/command_auth_spec.rb