Beispiel #1
0
 def test_creates_pair_set_table(self, mock_open, mock_mkdir, mock_connect):
     initialize()
     create_query = """CREATE TABLE pair_set
                           (id INTEGER NOT NULL PRIMARY KEY,
                           set_time INTEGER NOT NULL)
                           """
     mock_connect.return_value.execute.assert_any_call(create_query)
Beispiel #2
0
 def execute(self):
     if len(self._args) != 1:
         print('Invalid arguments.\n\n   {}'.format(self.help()))
     else:
         if not already_initialized():
             initialize()
         else:
             print('Config folder already exists.')
Beispiel #3
0
 def test_creates_committer_table(self, mock_open, mock_mkdir,
                                  mock_connect):
     initialize()
     create_query = """CREATE TABLE committer
                           (initials TEXT NOT NULL PRIMARY KEY,
                            name TEXT NOT NULL,
                            email TEXT NOT NULL)"""
     mock_connect.return_value.execute.assert_any_call(create_query)
Beispiel #4
0
 def test_creates_pair_set_committer_table(self, mock_open, mock_mkdir,
                                           mock_connect):
     initialize()
     create_query = """CREATE TABLE pair_set_committer
                           (id INTEGER NOT NULL PRIMARY KEY,
                           committer_initials TEXT NOT NULL,
                           pair_set_id INTEGER NOT NULL,
                           FOREIGN KEY (pair_set_id) REFERENCES pair_set(id),
                           FOREIGN KEY (committer_initials) REFERENCES comitter(initials)
                           )
                           """
     mock_connect.return_value.execute.assert_any_call(create_query)
Beispiel #5
0
 def test_creates_file_for_current_author_name(self, mock_open, mock_mkdir,
                                               mock_connect):
     initialize()
     mock_open.assert_any_call(
         join(app_config_directory_path, constants.AUTHOR_NAME), 'w')
Beispiel #6
0
 def test_creates_file_for_current_committer_names(self, mock_open,
                                                   mock_mkdir,
                                                   mock_connect):
     initialize()
     mock_open.assert_any_call(
         join(app_config_directory_path, constants.COMMITTER_NAMES), 'w')
Beispiel #7
0
 def test_closes_connection(self, mock_open, mock_mkdir, mock_connect):
     initialize()
     mock_connect.return_value.close.assert_called()
Beispiel #8
0
 def test_connects_to_datasource_file_in_configuration_folder_to_create_it(
         self, mock_open, mock_mkdir, mock_connect):
     initialize()
     mock_connect.assert_called_with(
         join(app_config_directory_path, constants.DATA_SOURCE_NAME))
Beispiel #9
0
 def test_creates_app_configuration_folder_in_user_home_directory_if_it_does_not_exist(
         self, mock_open, mock_mkdir, mock_connect):
     initialize()
     mock_mkdir.assert_any_call(app_config_directory_path)