Project

General

Profile

Download (816 Bytes) Statistics
| Branch: | Tag: | Revision:

hammer-cli-csv / test / users_test.rb @ d9498f54

1
require File.join(File.dirname(__FILE__), 'csv_test_helper')
2

    
3
require 'stringio'
4
require 'tempfile'
5

    
6
describe 'users' do
7

    
8
  extend CommandTestHelper
9

    
10
  before :each do
11
    HammerCLI::Settings.load_from_file 'test/config.yml'
12
  end
13

    
14
  context "import" do
15

    
16
    it "hammer -v csv:users --csv-file tempfile" do
17
      file = Tempfile.new('users_test')
18
      file.write(
19
<<-eos
20
Name,Count,First Name,Last Name,Email,Organizations,Locations,Roles
21
damon.dials@megacorp.com,1,Damon,Dials,damon.dials@megacorp.com,Mega Corporation,,
22
eos
23
                   )
24
      file.rewind
25

    
26
      stdout,stderr = capture {
27
        hammer.run(%W{csv users -v --csv-file #{file.path}})
28
      }
29
      stderr.must_equal ''
30
      stdout[0..-2].must_equal 'Updating user \'damon.dials@megacorp.com\'... done'
31
      file.unlink
32
    end
33

    
34
  end
35
end