Esempio n. 1
0
 def test_detects_added_removed_and_modified(self):
     mock_online_boards, mock_offline_boards = _make_mbed_boards_for_diff(
         [BOARD_3, BOARD_2], [BOARD_1, BOARD_2_MODIFIED])
     result = sync_board_database.compare_databases(mock_offline_boards,
                                                    mock_online_boards)
     self.assertEqual(len(result.boards_modified), 1)
     self.assertEqual(len(result.boards_added), 1)
     self.assertEqual(len(result.boards_removed), 1)
Esempio n. 2
0
 def test_detects_removed(self):
     mock_offline_boards, mock_online_boards = _make_mbed_boards_for_diff(
         [BOARD_1, BOARD_2], [BOARD_1])
     result = sync_board_database.compare_databases(mock_offline_boards,
                                                    mock_online_boards)
     self.assertEqual(len(result.boards_added), 0,
                      "Expect no boards to be added to offline db.")
     self.assertEqual(len(result.boards_removed), 1,
                      "Expect one board to be removed from offline db.")
Esempio n. 3
0
 def test_returns_empty_when_no_change(self):
     mock_offline_boards, mock_online_boards = _make_mbed_boards_for_diff(
         [BOARD_1], [BOARD_1])
     result = sync_board_database.compare_databases(mock_offline_boards,
                                                    mock_online_boards)
     self.assertEqual(
         len(result.boards_added), 0,
         "Returns an empty targets container when no targets added")
     self.assertEqual(
         len(result.boards_removed), 0,
         "Returns an empty targets container when no targets removed.")
Esempio n. 4
0
 def test_text_formatting_for_boards_modified(self):
     mock_online_boards, mock_offline_boards = _make_mbed_boards_for_diff(
         [BOARD_2], [BOARD_2_MODIFIED])
     result = sync_board_database.compare_databases(
         online_boards=mock_online_boards,
         offline_boards=mock_offline_boards)
     text = sync_board_database.create_news_file_text_from_result(result)
     self.assertEqual(
         text,
         f"Targets modified: {BOARD_2['attributes']['name']}.\n",
         "Text is formatted correctly.",
     )