mocket.mocket.Mocket.register

Here are the examples of the python api mocket.mocket.Mocket.register taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

Example 1

Project: pynats Source File: test_connection.py
Function: init
    def __init__(self, expected, response):
        self.location = ('localhost', 4444)
        mocket.Mocket.register(self)
        self.expected = expected
        self.response = response
        self.calls = 0

Example 2

Project: python-mocket Source File: test_mocket.py
Function: test_register
    def test_register(self):
        entry_1 = MocketEntry(('localhost', 80), True)
        entry_2 = MocketEntry(('localhost', 80), True)
        entry_3 = MocketEntry(('localhost', 8080), True)
        Mocket.register(entry_1, entry_2, entry_3)
        self.assertEqual(Mocket._entries, {
            ('localhost', 80): [entry_1, entry_2],
            ('localhost', 8080): [entry_3],
        })

Example 3

Project: python-mocket Source File: test_mocket.py
Function: test_get_entry
    def test_getentry(self):
        entry = MocketEntry(('localhost', 80), True)
        Mocket.register(entry)
        self.assertEqual(Mocket.get_entry('localhost', 80, True), entry)