Пример #1
0
 def setUp(self):
     self.click_command = "<ButtonRelease-1>"
     self.key_test_dir = 'tests/data/keys'
     self.db_file_path = 'models/db/tests/testdatabasesmain.sqlite'
     self.db_table = dbcontactrequesttable.DBContactRequestTable(
         self.db_file_path)
     self.last_record = self.db_table.fetch_last_record()
     self.nonce = self.last_record[1]
     self.record = self.db_table.fetch_one_by_nonce(self.nonce)
     self.invalid_record = list(self.record)
     self.invalid_record[-1] = 'xxx'
     self.invalid_record = self.db_table.build_named_tuple(
         self.invalid_record)
     self.root = tkinter.Tk()
     with patch.object(contactrequestcontroller.contactrequestvalidator,
                       'ContactRequestValidator'):
         self.x = contactrequestcontroller.ContactRequestController(
             self.root, self.record)
Пример #2
0
 def test_validator_takes_contact_req_dict_as_arg(self):
     self.x = contactrequestcontroller.ContactRequestController(
         self.root, self.record)
     self.assertEqual(self.x.validator.contact_req_dict, self.x.data_dict)
Пример #3
0
 def test_validator_attribute_is_instance_of_validator(self):
     self.x = contactrequestcontroller.ContactRequestController(
         self.root, self.record)
     self.assertIsInstance(self.x.validator,
                           contactrequestvalidator.ContactRequestValidator)
Пример #4
0
 def test_config_event_bindings_method_called_by_constructor(self, mocked):
     x = contactrequestcontroller.ContactRequestController(
         self.root, self.record)
     self.assertTrue(mocked.called)
Пример #5
0
 def test_init_returns_false_if_invalid_input(self, target):
     invalid = contactrequestcontroller.ContactRequestController(
         self.root, self.invalid_record)
     target.assert_called_with()