示例#1
0
 def test_mockclient(self):
     '''
     A MockFileClient is used that records all file request normally send to the master.
     '''
     loader = SaltCacheLoader({'cachedir': TEMPLATES_DIR}, 'test')
     fc = MockFileClient(loader)
     res = loader.get_source(None, 'hello_simple')
     assert len(res) == 3
     self.assertEqual(res[0], 'world\n')
     self.assertEqual(res[1], '%s/files/test/hello_simple' % TEMPLATES_DIR)
     assert res[2](), "Template up to date?"
     assert len(fc.requests)
     self.assertEqual(fc.requests[0]['path'], 'salt://hello_simple')
示例#2
0
文件: jinja_test.py 项目: vonion/salt
 def test_mockclient(self):
     '''
     A MockFileClient is used that records all file requests normally sent
     to the master.
     '''
     loader = SaltCacheLoader({'cachedir': TEMPLATES_DIR}, 'test')
     fc = MockFileClient(loader)
     res = loader.get_source(None, 'hello_simple')
     assert len(res) == 3
     # res[0] on Windows is unicode and use os.linesep so it works cross OS
     self.assertEqual(str(res[0]), 'world' + os.linesep)
     tmpl_dir = os.path.join(TEMPLATES_DIR, 'files', 'test', 'hello_simple')
     self.assertEqual(res[1], tmpl_dir)
     assert res[2](), 'Template up to date?'
     assert len(fc.requests)
     self.assertEqual(fc.requests[0]['path'], 'salt://hello_simple')
示例#3
0
 def test_mockclient(self):
     '''
     A MockFileClient is used that records all file requests normally sent
     to the master.
     '''
     loader = SaltCacheLoader({'cachedir': TEMPLATES_DIR}, 'test')
     fc = MockFileClient(loader)
     res = loader.get_source(None, 'hello_simple')
     assert len(res) == 3
     # res[0] on Windows is unicode and use os.linesep so it works cross OS
     self.assertEqual(str(res[0]), 'world' + os.linesep)
     tmpl_dir = os.path.join(TEMPLATES_DIR, 'files', 'test', 'hello_simple')
     self.assertEqual(res[1], tmpl_dir)
     assert res[2](), 'Template up to date?'
     assert len(fc.requests)
     self.assertEqual(fc.requests[0]['path'], 'salt://hello_simple')
示例#4
0
文件: jinja_test.py 项目: rrada/salt
 def test_mockclient(self):
     """
     A MockFileClient is used that records all file requests normally sent
     to the master.
     """
     loader = SaltCacheLoader({"cachedir": TEMPLATES_DIR}, "test")
     fc = MockFileClient(loader)
     res = loader.get_source(None, "hello_simple")
     assert len(res) == 3
     # res[0] on Windows is unicode and use os.linesep so it works cross OS
     self.assertEqual(str(res[0]), "world" + os.linesep)
     tmpl_dir = os.path.join(TEMPLATES_DIR, "files", "test", "hello_simple")
     self.assertEqual(res[1], tmpl_dir)
     assert res[2](), "Template up to date?"
     assert len(fc.requests)
     self.assertEqual(fc.requests[0]["path"], "salt://hello_simple")