Esempio n. 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')
Esempio n. 2
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')
Esempio n. 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')
Esempio n. 4
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")