Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

Commit c4d29c3

Browse files
committed
add unittests for utils.es_header
1 parent 3ceb1dd commit c4d29c3

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

tests/test_utils.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,23 @@ def test_get_json(self):
5555
"test@cern.ch", "test@testmail.com"])
5656

5757
def test_get_mongodb(self):
58-
58+
5959
# TODO: mock db and write tests
6060
pass
6161

6262

63+
class TestEsHeader(unittest.TestCase):
64+
65+
def test_es_header(self):
66+
from WmAgentScripts.utils import es_header
67+
mock_date = mock_open(read_data=u"fake_entrypointname:fake_password")
68+
with patch('__builtin__.open', mock_date):
69+
result = es_header()
70+
fake_result = {
71+
'Content-Type': 'application/json',
72+
'Authorization': 'Basic ZmFrZV9lbnRyeXBvaW50bmFtZTpmYWtlX3Bhc3N3b3Jk'}
73+
self.assertEqual(result, fake_result)
74+
75+
6376
if __name__ == '__main__':
6477
unittest.main()

0 commit comments

Comments
 (0)