Пример #1
0
    def test_get_many(self):
        myvars = global_status.get_many([])
        assert myvars == {}

        myvars = global_status.get_many(['Threads_running', 'Uptime'])
        assert isinstance(myvars, dict)
        assert 'Threads_running' in myvars
        assert isinstance(myvars['Threads_running'], int)
        assert 'Uptime' in myvars
        assert isinstance(myvars['Uptime'], int)

        with pytest.raises(ValueError) as excinfo:
            global_status.get_many(['foo%'])
        assert 'wildcards' in str(excinfo.value)
Пример #2
0
    def test_get_many(self):
        myvars = global_status.get_many([])
        self.assertEqual(myvars, {})

        myvars = global_status.get_many(['Threads_running', 'Uptime'])
        self.assertTrue(isinstance(myvars, dict))
        self.assertIn('Threads_running', myvars)
        self.assertTrue(isinstance(myvars['Threads_running'], int))
        self.assertIn('Uptime', myvars)
        self.assertTrue(isinstance(myvars['Uptime'], int))

        with self.assertRaises(ValueError) as cm:
            global_status.get_many(['foo%'])
        self.assertIn('wildcards', str(cm.exception))
Пример #3
0
 def test_get_many_existent(self):
     myvars = global_status.get_many(['Threads_running', 'Uptime'])
     assert isinstance(myvars, dict)
     assert 'Threads_running' in myvars
     assert isinstance(myvars['Threads_running'], int)
     assert 'Uptime' in myvars
     assert isinstance(myvars['Uptime'], int)
Пример #4
0
 def test_get_many_existent(self):
     myvars = global_status.get_many(['Threads_running', 'Uptime'])
     assert isinstance(myvars, dict)
     assert 'Threads_running' in myvars
     assert isinstance(myvars['Threads_running'], int)
     assert 'Uptime' in myvars
     assert isinstance(myvars['Uptime'], int)
Пример #5
0
 def test_get_many_existent(self):
     myvars = global_status.get_many(["Threads_running", "Uptime"])
     assert isinstance(myvars, dict)
     assert "Threads_running" in myvars
     assert isinstance(myvars["Threads_running"], int)
     assert "Uptime" in myvars
     assert isinstance(myvars["Uptime"], int)
Пример #6
0
 def test_get_many_bad_name(self):
     with pytest.raises(ValueError) as excinfo:
         global_status.get_many(['foo%'])
     assert 'wildcards' in str(excinfo.value)
Пример #7
0
 def test_get_many_empty(self):
     myvars = global_status.get_many([])
     assert myvars == {}
Пример #8
0
 def test_get_many_bad_name(self):
     with pytest.raises(ValueError) as excinfo:
         global_status.get_many(['foo%'])
     assert 'wildcards' in str(excinfo.value)
Пример #9
0
 def test_get_many_empty(self):
     myvars = global_status.get_many([])
     assert myvars == {}