示例#1
0
def test_with_data_store(mocker):
    """Test when the data store is already set."""
    mock_data_store = mocker.MagicMock(
        spec=phonebook._datastore.base.BaseDataStore)
    mocker.patch.object(phonebook._main, "_DATA_STORE", mock_data_store)

    phonebook.get(_USER["name"])

    mock_data_store.get.assert_called_once_with(_USER["name"])
 def _verify_number(self, name, number):
     self.assertEquals(phonebook.get(name), number)
 def _verify_add_and_get(self, name, number):
     self.assertEquals(phonebook.add(name, number), True)
     self.assertEquals(phonebook.get(name), number)
示例#4
0
def _handle_get(args):
    """Output the result of the "get" command."""
    result = phonebook.get(args.name)
    _print_result(result, args.output_format)
示例#5
0
 def _verify_not_added(self, name, number):
     self.assertEquals(phonebook.add(name, number), False)
     self.assertEquals(phonebook.get(name), "Unknown")
示例#6
0
 def _verify_number(self, name, number):
     self.assertEquals(phonebook.get(name), number)
示例#7
0
 def _verify_add_and_get(self, name, number):
     self.assertEquals(phonebook.add(name, number), True)
     self.assertEquals(phonebook.get(name), number)