def test_correct_node_state(self): s1 = {'edition_time': '2011-12-05T13:51:36.955Z'} ps1 = state.parse_state(json.dumps(s1)) cursor = connection.cursor() checks1 = state.collect_state_checks(247, ps1, cursor, node=True) state.check_state(ps1, checks1, cursor)
def test_correct_node_state(self): s1 = { 'edition_time': '2011-12-05T13:51:36.955Z' } ps1 = state.parse_state(json.dumps(s1)) cursor = connection.cursor() checks1 = state.collect_state_checks(247, ps1, cursor, node=True) state.check_state(ps1, checks1, cursor)
def test_wrong_node_state(self): s1 = {'edition_time': '2016-03-15T03:37:56.217Z'} ps1 = state.parse_state(json.dumps(s1)) cursor = connection.cursor() checks1 = state.collect_state_checks(247, ps1, cursor, node=True) self.assertEqual(len(checks1), 1) self.assertRaises(state.StateMatchingError, lambda: state.check_state(ps1, checks1, cursor)) s2 = {'edition_time': '2011-12-05T13:51:36.855Z'} ps2 = state.parse_state(json.dumps(s2)) checks2 = state.collect_state_checks(247, ps2, cursor, node=True) self.assertEqual(len(checks2), 1) self.assertRaises(state.StateMatchingError, lambda: state.check_state(ps2, checks2, cursor))
def test_wrong_node_state(self): s1 = { 'edition_time': '2016-03-15T03:37:56.217Z' } ps1 = state.parse_state(json.dumps(s1)) cursor = connection.cursor() checks1 = state.collect_state_checks(247, ps1, cursor, node=True) self.assertEqual(len(checks1), 1) self.assertRaises(state.StateMatchingError, lambda: state.check_state(ps1, checks1, cursor)) s2 = { 'edition_time': '2011-12-05T13:51:36.855Z' } ps2 = state.parse_state(json.dumps(s2)) checks2 = state.collect_state_checks(247, ps2, cursor, node=True) self.assertEqual(len(checks2), 1) self.assertRaises(state.StateMatchingError, lambda: state.check_state(ps2, checks2, cursor))