Skip to content

Commit

Permalink
change assets snapshot -> identifiers_snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
bishoy-at-pieces committed Jun 25, 2024
1 parent 543f174 commit 43a0505
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Pieces.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"caption": "Pieces: About",
"command": "pieces_about"
},
{
{
"caption": "Pieces: Open Pieces Settings",
"command": "edit_settings",
"args":
Expand Down
6 changes: 3 additions & 3 deletions tests/test_create_and_delete_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ def test_create_command(self):
self.view.run_command("pieces_create_asset",args={"data":self.text_asset})
yield 1000

TestCreateAndDeleteCommand.asset_id = list(AssetSnapshot.assets_snapshot.keys())[0]
raw = AssetSnapshot.assets_snapshot[TestCreateAndDeleteCommand.asset_id].original.reference.fragment.string.raw
TestCreateAndDeleteCommand.asset_id = list(AssetSnapshot.identifiers_snapshot.keys())[0]
raw = AssetSnapshot.identifiers_snapshot[TestCreateAndDeleteCommand.asset_id].original.reference.fragment.string.raw

self.assertEqual(raw,self.text_asset)

@patch('sublime.ok_cancel_dialog', return_value=True)
def test_delete_command(self,mock_ok_cancel):
self.window.run_command("pieces_delete_asset")
yield 500
self.assertIsNone(AssetSnapshot.assets_snapshot.get(TestCreateAndDeleteCommand.asset_id))
self.assertIsNone(AssetSnapshot.identifiers_snapshot.get(TestCreateAndDeleteCommand.asset_id))
4 changes: 2 additions & 2 deletions tests/test_list_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_assets_list(self):


def test_run_command(self):
self.command.run(list(AssetSnapshot.assets_snapshot.keys())[0]) # Open the first asset
self.command.run(list(AssetSnapshot.identifiers_snapshot.keys())[0]) # Open the first asset
yield 500 # wait for the command to run
sheet_id = list(PiecesListAssetsCommand.sheets_md.keys())[0]
# Make sure the correct asset is generate successfully
Expand All @@ -33,7 +33,7 @@ def test_run_command(self):
# Checkout the extracted code
code = PiecesListAssetsCommand.sheets_md[sheet_id]["code"]
asset_id = PiecesListAssetsCommand.sheets_md[sheet_id]["id"]
raw = AssetSnapshot.assets_snapshot[asset_id].original.reference.fragment.string.raw
raw = AssetSnapshot.identifiers_snapshot[asset_id].original.reference.fragment.string.raw
self.assertEqual(code,raw)


4 changes: 2 additions & 2 deletions tests/test_markdown_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def setUp(self):
self.view = self.window.new_file()
self.command = PiecesHandleMarkdownCommand(self.window)
yield 3000 # Wait 3 sec for everythin to load (websockets)
self.asset_id = list(AssetSnapshot.assets_snapshot.keys())[0] # id to test on
self.asset_id = list(AssetSnapshot.identifiers_snapshot.keys())[0] # id to test on


def tearDown(self):
Expand All @@ -41,7 +41,7 @@ def test_edit_command(self):

yield 500 # Wait some until the changes recevied by the websocket

code = AssetSnapshot.assets_snapshot[self.asset_id].original.reference.fragment.string.raw
code = AssetSnapshot.identifiers_snapshot[self.asset_id].original.reference.fragment.string.raw

self.assertTrue(code.endswith(self.test_text)) # Make sure the code edited properly

2 changes: 1 addition & 1 deletion tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_search_input_handler(self):

def test_query_input_handler(self):
SearchTypeInputHandler.search_type = "assets"
asset = list(AssetSnapshot.assets_snapshot.values())[0]
asset = list(AssetSnapshot.identifiers_snapshot.values())[0]
search_query = asset.name
input = QueryInputHandler().next_input({"search_type":SearchTypeInputHandler.search_type,"query":search_query})
items = input.list_items()
Expand Down

0 comments on commit 43a0505

Please sign in to comment.