Sha256: 486db829aeafd7687df2d3804f3f88af21b2e3b449e204fa3ef58e5f140c1751

Contents?: true

Size: 1.59 KB

Versions: 29

Compression:

Stored size: 1.59 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# Global requires
require 'multi_json'

# Local requires
require 'gooddata/models/models'

require_relative '../environment/environment'

GoodData::Environment.load

module GoodData::Helpers
  module ProjectHelper
    include GoodData::Environment::ProjectHelper

    ENVIRONMENT = 'TESTING'

    class << self
      def get_default_project(opts = {:client => GoodData.connection})
        GoodData::Project[GoodData::Helpers::ProjectHelper::PROJECT_ID, opts]
      end

      def delete_old_projects(opts = {:client => GoodData.connection})
        projects = opts[:client].projects
        projects.each do |project|
          next if project.json['project']['meta']['author'] != client.user.uri
          next if project.pid == 'we1vvh4il93r0927r809i3agif50d7iz'
          begin
            puts "Deleting project #{project.title}"
            project.delete
          rescue e
            puts 'ERROR: ' + e.to_s
          end
        end
      end

      def create_random_user(client)
        num = rand(1e7)
        login = "gemtest#{num}@gooddata.com"

        opts = {
          email: login,
          login: login,
          first_name: 'the',
          last_name: num.to_s,
          role: 'editor',
          password: CryptoHelper.generate_password,
          domain: ConnectionHelper::DEFAULT_DOMAIN
        }
        GoodData::Membership.create(opts, client: client)
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
gooddata-edge-0.6.27.edge spec/helpers/project_helper.rb
gooddata-0.6.49 spec/helpers/project_helper.rb
gooddata-0.6.48 spec/helpers/project_helper.rb
gooddata-0.6.47 spec/helpers/project_helper.rb
gooddata-0.6.46 spec/helpers/project_helper.rb
gooddata-0.6.45 spec/helpers/project_helper.rb
gooddata-0.6.44 spec/helpers/project_helper.rb
gooddata-0.6.43 spec/helpers/project_helper.rb
gooddata-0.6.42 spec/helpers/project_helper.rb
gooddata-0.6.41 spec/helpers/project_helper.rb
gooddata-0.6.40 spec/helpers/project_helper.rb
gooddata-0.6.39 spec/helpers/project_helper.rb
gooddata-0.6.38 spec/helpers/project_helper.rb
gooddata-0.6.37 spec/helpers/project_helper.rb
gooddata-0.6.36 spec/helpers/project_helper.rb
gooddata-0.6.35 spec/helpers/project_helper.rb
gooddata-0.6.34 spec/helpers/project_helper.rb
gooddata-0.6.33 spec/helpers/project_helper.rb
gooddata-0.6.32 spec/helpers/project_helper.rb
gooddata-0.6.31 spec/helpers/project_helper.rb