# Path: app/gates.py
# def test_against_global_rules(rules, env, lt):
#     blocking_rules = set()
#     unblocking_rules = set()
#     if env in rules:
#         for k, v in rules[env].items():
#             hours = v['hours_range']
#             days = v['days_range']
#             if util.is_unblocked_by_rule(lt, hours, days):
#                 unblocking_rules.add(k)
#             else:
#                 blocking_rules.add(k)
#         return unblocking_rules, blocking_rules
#     return set(), set()


import unittest
import time
import sys
from app.gates import test_against_global_rules
        ur, br = test_against_global_rules(test_rules, "live", time.strptime("18 46 0", "%H %M %w"))
        self.assertFalse(ur)
        self.assertTrue(br)

    def test_global_rules_inside(self):
        ur, br = test_against_global_rules(test_rules, "live", time.strptime("14 01 1", "%H %M %w"))
        self.assertTrue(br)
        self.assertTrue(ur)

        ur, br = test_against_global_rules(test_rules, "live", time.strptime("10 59 2", "%H %M %w"))
        self.assertTrue(br)
        self.assertTrue(ur)

        ur, br = test_against_global_rules(test_rules, "live", time.strptime("15 59 4", "%H %M %w"))
        self.assertTrue(br)
        self.assertTrue(ur)

        ur, br = test_against_global_rules(test_rules, "live", time.strptime("13 59 5", "%H %M %w"))
        self.assertTrue(br)
        self.assertTrue(ur)

        ur, br = test_against_global_rules(test_rules, "live", time.strptime("9 46 3", "%H %M %w"))
        self.assertTrue(br)
        self.assertTrue(ur)

    def test_global_rules_weekend(self):
        ur, br = test_against_global_rules(test_rules, "live", time.strptime("10 01 6", "%H %M %w"))
        self.assertFalse(ur)
        self.assertTrue(br)


# Path: app/gates.py
# def test_against_global_rules(rules, env, lt):
#     blocking_rules = set()
#     unblocking_rules = set()
#     if env in rules:
#         for k, v in rules[env].items():
#             hours = v['hours_range']
#             days = v['days_range']
#             if util.is_unblocked_by_rule(lt, hours, days):
#                 unblocking_rules.add(k)
#             else:
#                 blocking_rules.add(k)
#         return unblocking_rules, blocking_rules
#     return set(), set()


# Path: tests/test_business_rules.py
import unittest
import time
import sys
from app.gates import test_against_global_rules

        ur, br = test_against_global_rules(test_rules, "live", time.strptime("18 46 0", "%H %M %w"))
        self.assertFalse(ur)
        self.assertTrue(br)

    def test_global_rules_inside(self):
        ur, br = test_against_global_rules(test_rules, "live", time.strptime("14 01 1", "%H %M %w"))
        self.assertTrue(br)
        self.assertTrue(ur)

        ur, br = test_against_global_rules(test_rules, "live", time.strptime("10 59 2", "%H %M %w"))
        self.assertTrue(br)
        self.assertTrue(ur)

        ur, br = test_against_global_rules(test_rules, "live", time.strptime("15 59 4", "%H %M %w"))
        self.assertTrue(br)
        self.assertTrue(ur)

        ur, br = test_against_global_rules(test_rules, "live", time.strptime("13 59 5", "%H %M %w"))
        self.assertTrue(br)
        self.assertTrue(ur)

        ur, br = test_against_global_rules(test_rules, "live", time.strptime("9 46 3", "%H %M %w"))
        self.assertTrue(br)
        self.assertTrue(ur)

    def test_global_rules_weekend(self):
        ur, br = test_against_global_rules(test_rules, "live", time.strptime("10 01 6", "%H %M %w"))
        self.assertFalse(ur)
        self.assertTrue(br)


        ur, br = test_against_global_rules(test_rules, "live", time.strptime("15 45 6", "%H %M %w"))