示例#1
0
    def test_should_return_empty_dict_for_unknown_backend(self):
        state = ServerState()

        state.update_backend('varnish1', 'web2', 'healthy', '200', 'OK')

        backend_state = state.get_backend('varnish1', 'web1')

        self.assertEquals({}, backend_state)
示例#2
0
    def test_should_return_empty_dict_for_unknown_backend(self):
        state = ServerState()

        state.update_backend('varnish1', 'web2', 'healthy', '200', 'OK')

        backend_state = state.get_backend('varnish1', 'web1')

        self.assertEquals({}, backend_state)
示例#3
0
    def test_should_update_backend_state(self, now_mock):
        now_mock.return_value = datetime(2011, 10, 0o1)
        state = ServerState()

        state.update_backend('varnish1', 'web2', 'healthy', '200', 'OK')

        backend_state = state.get_backend('varnish1', 'web2')

        self.assertEquals({'name': 'web2', 'state': 'healthy',
                           'status_code': '200', 'status_text': 'OK',
                           'timestamp': '2011-09-30T23:00:00Z'},
                           backend_state)
示例#4
0
    def test_should_update_backend_state(self, now_mock):
        now_mock.return_value = datetime(2011, 10, 0o1)
        state = ServerState()

        state.update_backend('varnish1', 'web2', 'healthy', '200', 'OK')

        backend_state = state.get_backend('varnish1', 'web2')

        self.assertEquals(
            {
                'name': 'web2',
                'state': 'healthy',
                'status_code': '200',
                'status_text': 'OK',
                'timestamp': '2011-09-30T23:00:00Z'
            }, backend_state)
示例#5
0
    def test_should_return_empty_dict_for_unknown_hostname_for_backend(self):
        state = ServerState()

        backend_state = state.get_backend('varnish1', 'web1')

        self.assertEquals({}, backend_state)
示例#6
0
    def test_should_return_empty_dict_for_unknown_hostname_for_backend(self):
        state = ServerState()

        backend_state = state.get_backend('varnish1', 'web1')

        self.assertEquals({}, backend_state)