Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from __future__ import print_function 

2from builtins import str 

3import os 

4import unittest 

5import shutil 

6import yaml 

7from marshallEngine.utKit import utKit 

8from fundamentals import tools 

9from os.path import expanduser 

10home = expanduser("~") 

11 

12packageDirectory = utKit("").get_project_root() 

13# settingsFile = packageDirectory + "/test_settings.yaml" 

14settingsFile = home + "/git_repos/_misc_/settings/marshall/test_settings.yaml" 

15 

16su = tools( 

17 arguments={"settingsFile": settingsFile}, 

18 docString=__doc__, 

19 logLevel="DEBUG", 

20 options_first=False, 

21 projectName=None, 

22 defaultSettingsFile=False 

23) 

24arguments, settings, log, dbConn = su.setup() 

25 

26# SETUP PATHS TO COMMON DIRECTORIES FOR TEST DATA 

27moduleDirectory = os.path.dirname(__file__) 

28pathToInputDir = moduleDirectory + "/input/" 

29pathToOutputDir = moduleDirectory + "/output/" 

30 

31try: 

32 shutil.rmtree(pathToOutputDir) 

33except: 

34 pass 

35# COPY INPUT TO OUTPUT DIR 

36shutil.copytree(pathToInputDir, pathToOutputDir) 

37 

38# Recursively create missing directories 

39if not os.path.exists(pathToOutputDir): 

40 os.makedirs(pathToOutputDir) 

41 

42class test_panstarrs_location_stamps(unittest.TestCase): 

43 

44 def test_panstarrs_location_stamps_function(self): 

45 

46 from fundamentals.mysql import writequery 

47 sqlQuery = """update pesstoObjects set ps1_map = 1; 

48 update pesstoObjects set ps1_map = null limit 10;""" % locals() 

49 writequery( 

50 log=log, 

51 sqlQuery=sqlQuery, 

52 dbConn=dbConn, 

53 ) 

54 

55 from marshallEngine.services import panstarrs_location_stamps 

56 ps_stamp = panstarrs_location_stamps( 

57 log=log, 

58 settings=settings, 

59 dbConn=dbConn, 

60 transientId=False 

61 ) 

62 ps_stamp.get() 

63 

64 def test_panstarrs_location_stamps_function_exception(self): 

65 

66 from marshallEngine.services import panstarrs_location_stamps 

67 try: 

68 this = panstarrs_location_stamps( 

69 log=log, 

70 settings=settings, 

71 fakeKey="break the code" 

72 ) 

73 this.get() 

74 assert False 

75 except Exception as e: 

76 assert True 

77 print(str(e)) 

78 

79 # x-print-testpage-for-pessto-marshall-web-object 

80 

81 # x-class-to-test-named-worker-function