Beispiel #1
0
 def test_get_no_hosts(self):
     registration = Registration()
     response, response_code = registration.get('foo')
     expected = {
         "hosts": [],
         "service": "foo",
         "env": "development"
     }
     assert response_code == 200
     assert response == expected
Beispiel #2
0
 def test_get_with_hosts(self, get_hosts):
     expected_hosts = [
         {
             'service': 'foo',
             'ip_address': '10.10.10.10',
             'service_repo_name': 'bar',
             'port': 10,
             'revision': 'blah',
             'last_check_in': 'timestamp',
             'tags': {
                 'az': 'woot',
                 'instance_id': 'wooooooooot'
             }
         },
         {
             'service': 'foo',
             'ip_address': '11.11.11.11',
             'service_repo_name': None,
             'port': 11,
             'revision': 'blah',
             'last_check_in': 'timestamp2',
             'tags': {
                 'az': 'woot',
                 'instance_id': 'wooooooooot'
             }
         },
     ]
     get_hosts.return_value = expected_hosts
     registration = Registration()
     registration._get_param = Mock(side_effect=self.generate_valid_params)
     response, response_code = registration.get('foo')
     expected = {
         "hosts": expected_hosts,
         "service": "foo",
         "env": "development"
     }
     assert response_code == 200
     assert response == expected