Changeset 70a0bec in flex_extract.git


Ignore:
Timestamp:
Aug 31, 2018, 5:08:15 PM (6 years ago)
Author:
Anne Philipp <anne.philipp@…>
Branches:
master, ctbto, dev
Children:
f9f7b3f
Parents:
b1d07c9
Message:

added test for put_file_to_ecserver and corrected a potential bug; test is not perfect since it needs user password. TODO: CHANGE

Location:
python
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/pythontest/TestTools.py

    r763fcf6 r70a0bec  
    55import sys
    66#import unittest
     7import subprocess
     8import pipes
    79import pytest
    810
     
    1012import _config
    1113from tools import (init128, to_param_id, my_error, read_ecenv,
    12                    get_cmdline_arguments, submit_job_to_ecserver)
     14                   get_cmdline_arguments, submit_job_to_ecserver,
     15                   put_file_to_ecserver)
    1316
    1417
     
    115118        assert True
    116119
    117     def test_put_file_to_ecserver(self):
    118         assert True
    119         #assert subprocess.call(['ssh', host, 'test -e ' + pipes.quote(path)]) == 0
     120    def test_success_put_file_to_ecserver(self):
     121        ecuid=os.environ['ECUID']#'km4a'
     122        ecgid=os.environ['ECGID']#'at'
     123        put_file_to_ecserver('TestData/', 'testfile.txt', 'ecgate', ecuid, ecgid)
     124        assert subprocess.call(['ssh', 'km4a@ecaccess.ecmwf.int' ,
     125                                'test -e ' +
     126                                pipes.quote('/home/ms/'+ecgid+'/'+ecuid)]) == 0
    120127
    121128    def test_fail_submit_job_to_ecserver(self):
     
    126133
    127134    def test_success_submit_job_to_ecserver(self):
    128 
    129135        result = submit_job_to_ecserver('ecgate', 'TestData/testfile.txt')
    130136        assert result == 0
  • python/tools.py

    rb1d07c9 r70a0bec  
    471471    try:
    472472        subprocess.check_call(['ecaccess-file-put',
    473                                ecd + '../' + filename,
     473                               ecd + '/' + filename,
    474474                               target + ':/home/ms/' +
    475475                               ecgid + '/' + ecuid +
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG