Project

General

Profile

Download (1.25 KB) Statistics
| Branch: | Tag: | Revision:

foreman_pipeline / test / unit / jenkins_instance_test.rb @ dce03a1e

1
require 'foreman_pipeline_plugin_test_helper'
2

    
3
class JenkinsInstanceTest < ActiveSupport::TestCase
4

    
5
  def setup
6
    @org = get_organization
7
    @valid_url = "http://somewhere.com:8080"
8
    @valid_home = "/var/lib/jenkins"
9
    @valid_cert_path = "/home/user/.ssh/foreman-jenkins"
10
  end
11

    
12
  test "should be valid" do
13
    @instance = ForemanPipeline::JenkinsInstance.create(:name => "test_jenkins_instance",
14
                                                        :url => @valid_url,
15
                                                        :cert_path => @valid_cert_path,
16
                                                        :jenkins_home => @valid_home,
17
                                                        :organization_id => @org.id)
18
    assert @instance.errors.empty?
19
  end
20

    
21
  test "should have url" do
22
    @instance = ForemanPipeline::JenkinsInstance.create(:name => "test_jenkins_instance",
23
                                                        :url => "invalid url",
24
                                                        :cert_path => @valid_cert_path,
25
                                                        :jenkins_home => @valid_home,
26
                                                        :organization_id => @org.id)
27
    refute @instance.errors.empty?
28
  end
29

    
30

    
31
end