Exemplo n.º 1
0
 def test_can_parse_agent_from_json_file(self):
     m = mock.mock_open(read_data=json.dumps(agent_mock.agent()))
     open_fn_name = ('builtins.open'
                     if sys.version_info[0] == 3 else '__builtin__.open')
     with mock.patch(open_fn_name, m, create=False):
         conn_mock = mock.MagicMock()
         conn_mock.host = 'a'
         conn_mock.token = 'a'
         ag = agent.from_file('test', conn_mock)
         self.assertEqual(ag.name, 'mock')
         self.assertEqual(ag.id, '1')
         self.assertEqual(ag.os, 'linux 13.04')
 def test_can_parse_agent_from_json_file(self):
     m = mock.mock_open(read_data=json.dumps(agent_mock.agent()))
     open_fn_name = ('builtins.open' if sys.version_info[0] == 3 else
                     '__builtin__.open')
     with mock.patch(open_fn_name, m, create=False):
         conn_mock = mock.MagicMock()
         conn_mock.host = 'a'
         conn_mock.token = 'a'
         ag = agent.from_file('test', conn_mock)
         self.assertEqual(ag.name, 'mock')
         self.assertEqual(ag.id, '1')
         self.assertEqual(ag.os, 'linux 13.04')
Exemplo n.º 3
0
 def setUp(self):
     _mock_auth(200)
     self.conn = Connection('1', 'dfw', password='******')
     self.client = Client(self.conn)
     self.agent = agent.from_dict(agent_mock.agent(), self.conn)
 def setUp(self):
     _mock_auth(200)
     self.conn = Connection('1', 'dfw', password='******')
     self.client = Client(self.conn)
     self.agent = agent.from_dict(agent_mock.agent(), self.conn)