Sha256: 7e2c0a891ae5b406fcd995fc86a7c2cc0e69617bf760414bd399c99cf04d37f6

Contents?: true

Size: 1.94 KB

Versions: 18

Compression:

Stored size: 1.94 KB

Contents

require 'logger'
require 'tempfile'

require 'helper'
require 'gooddata/command'

GoodData.logger = Logger.new(STDOUT)

class TestRestApiBasic < Test::Unit::TestCase
  context "datasets command" do
    SAMPLE_DATASET_CONFIG = {
      "columns" => [
        {
          "type"  => "CONNECTION_POINT",
          "name"  => "A1",
          "title" =>"A1"
        },
        {
          "type"  => "ATTRIBUTE",
          "name"  => "A2",
          "title" => "A2",
          "folder"=> "Test"
        },
        {
          "type"  => "FACT",
          "name"  => "F2",
          "title" => "F2 \"asdasd\"",
          "folder"=> "Test"
        }
      ],
      "title" => "Test"
    }

    should "list datasets" do
      GoodData::Command.run "datasets", [ "--project", $DEMO_PROJECT ]
    end

    should "apply a dataset model" do
      GoodData::Command.connect
      project = GoodData::Project.create \
        :title => "gooddata-ruby TestRestApi #{Time.new.to_i}", :template => '/projectTemplates/empty/1'

      Tempfile.open 'gdrb-test-' do |file|
        file.puts SAMPLE_DATASET_CONFIG.to_json
        file.close
        GoodData::Command.run "datasets:apply", [ "--project", project.uri, file.path ]
      end
      project.delete
    end
  end

  context "projects command" do
    should "list projects" do
      GoodData::Command.run "projects", []
    end
  end

  context "api command" do
    should "perform a test login" do
      GoodData::Command.run "api:test", []
    end

    should "get demo project's metadata" do
      GoodData::Command.run "api:get", [ "/gdc/md/#{$DEMO_PROJECT}" ]
    end
  end

  context "profile command" do
    should "show my GoodData profile" do
      GoodData::Command.run "profile", []
    end
  end

  context "help command" do
    should "print help screen" do
      GoodData::Command.run "help", []
    end
  end

  context "version command" do
    should "print version" do
      GoodData::Command.run "version", []
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
gooddata-0.5.16 test/test_commands.rb
gooddata-0.5.15 test/test_commands.rb
gooddata-0.5.14 test/test_commands.rb
gooddata-0.5.13 test/test_commands.rb
gooddata-0.5.12 test/test_commands.rb
gooddata-0.5.11 test/test_commands.rb
gooddata-0.5.10 test/test_commands.rb
gooddata-0.5.9 test/test_commands.rb
gooddata-0.5.8 test/test_commands.rb
gooddata-0.5.7 test/test_commands.rb
gooddata-0.5.6 test/test_commands.rb
gooddata-0.5.5 test/test_commands.rb
gooddata-0.5.4 test/test_commands.rb
gooddata-0.5.3 test/test_commands.rb
gooddata-0.5.2 test/test_commands.rb
gooddata-0.5.1 test/test_commands.rb
gooddata-0.5.0 test/test_commands.rb
gooddata-0.4.0 test/test_commands.rb